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

feat: support adding files via async iterator #1078

Merged
merged 1 commit into from
Aug 29, 2019

Conversation

achingbrain
Copy link
Collaborator

Adds a method called ipfs._addAsyncIterator, prefixed with an underscore to mark it as sort of unofficial (though it's what ipfs.add will become once the async iterator migration is complete) and we don't want to implement symmetrical ipfs.catAsyncIterator etc methods, or at least not yet.

Also adds support for sending the pin and (non-standard, JS-specific) preload arguments via HTTP.

@alanshaw
Copy link
Contributor

This is super cool, note that #1063 is in the pipeline :)

Adds a method called `ipfs._addAsyncIterator`, prefixed with an
underscore to mark it as sort of unofficial (though it's what
`ipfs.add` will become once the async iterator migration is complete)
and we don't want to implement symmetrical `ipfs.catAsyncIterator`
etc methods, or at least not yet.
const stream = SendFilesStream(send, 'add')(options)

for await (const entry of source) {
stream.write(entry)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to do some conversion of entry.content?

@alanshaw alanshaw merged commit 377042b into master Aug 29, 2019
@alanshaw alanshaw deleted the support-async-iterators branch August 29, 2019 11:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants