ipfs-utils
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,11 @@ | ||
<a name="2.1.0"></a> | ||
# [2.1.0](https://github.com/ipfs/js-ipfs-utils/compare/v2.0.0...v2.1.0) (2020-04-13) | ||
### Features | ||
* add iterator method to response ([#36](https://github.com/ipfs/js-ipfs-utils/issues/36)) ([8f7c96c](https://github.com/ipfs/js-ipfs-utils/commit/8f7c96c)) | ||
<a name="2.0.0"></a> | ||
@@ -2,0 +12,0 @@ # [2.0.0](https://github.com/ipfs/js-ipfs-utils/compare/v1.2.4...v2.0.0) (2020-04-09) |
{ | ||
"name": "ipfs-utils", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Package to aggregate shared logic and dependencies for the IPFS ecosystem", | ||
@@ -55,2 +55,3 @@ "main": "src/index.js", | ||
"it-drain": "^1.0.0", | ||
"it-last": "^1.0.1", | ||
"it-to-stream": "^0.1.1" | ||
@@ -57,0 +58,0 @@ }, |
@@ -8,7 +8,8 @@ 'use strict' | ||
const http = new Http() | ||
const response = await http.get(url) | ||
yield { | ||
path: decodeURIComponent(new URL(url).pathname.split('/').pop() || ''), | ||
content: await http.iterator(url, { method: 'get' }) | ||
content: response.iterator() | ||
} | ||
} |
@@ -139,3 +139,3 @@ /* eslint-disable no-undef */ | ||
response.ndjson = async function * () { | ||
response.iterator = function () { | ||
const it = streamToAsyncIterator(response.body) | ||
@@ -147,3 +147,7 @@ | ||
for await (const chunk of ndjson(it)) { | ||
return it | ||
} | ||
response.ndjson = async function * () { | ||
for await (const chunk of ndjson(response.iterator())) { | ||
if (options.transform) { | ||
@@ -150,0 +154,0 @@ yield options.transform(chunk) |
54903
922
9