Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
chore: start stream flowing in test
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Oct 8, 2019
1 parent 2d4c571 commit d9986ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/components/files-regular/get-readable-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const toStream = require('it-to-stream')

module.exports = function (self) {
return function getReadableStream (ipfsPath, options) {
return toStream.readable((async function * () {
return toStream.readable((async function * mapStreamFileContents () {
for await (const file of self._getAsyncIterator(ipfsPath, options)) {
if (file.content) {
file.content = toStream.readable(file.content())
}

yield file
}
}()), {
})(), {
objectMode: true
})
}
Expand Down
1 change: 1 addition & 0 deletions test/core/files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('files', function () {
const invalidPath = null
const stream = ipfs.getReadableStream(invalidPath)

stream.on('data', () => {})
stream.on('error', (err) => {
expect(err).to.exist()
expect(err.code).to.equal('ERR_INVALID_PATH')
Expand Down

0 comments on commit d9986ee

Please sign in to comment.