Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit c633449

Browse files
author
Alan Shaw
committed
fix: allow non-streaming but stream by default
1 parent f545be3 commit c633449

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/pin/ls.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = configure(({ ky }) => {
1717
options = options || {}
1818

1919
const searchParams = new URLSearchParams(options.searchParams)
20-
searchParams.set('stream', true)
20+
searchParams.set('stream', options.stream == null ? true : options.stream)
2121
path.forEach(p => searchParams.append('arg', `${p}`))
2222
if (options.type) searchParams.set('type', options.type)
2323

@@ -29,8 +29,7 @@ module.exports = configure(({ ky }) => {
2929
})
3030

3131
for await (const pin of ndjson(toIterable(res.body))) {
32-
// For nodes that do not understand the `stream option`
33-
if (pin.Keys) {
32+
if (pin.Keys) { // non-streaming response
3433
for (const cid of Object.keys(pin.Keys)) {
3534
yield { cid: new CID(cid), type: pin.Keys[cid].Type }
3635
}

0 commit comments

Comments
 (0)