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

ipfs.add should always return same type #79

Closed
victorb opened this issue Oct 19, 2015 · 5 comments
Closed

ipfs.add should always return same type #79

victorb opened this issue Oct 19, 2015 · 5 comments
Labels

Comments

@victorb
Copy link
Contributor

victorb commented Oct 19, 2015

ipfs.add have a kind of confused API (the same with some other methods), that it's sometimes returning a stream and sometimes an object. I think this is because of the environment but we should try to make sure that inside the callback, users don't have to try to figure out what type it is, it should always be the same type.

Will also help simplifying the tests for browser/node environments.

@victorb victorb changed the title ipfs.add should return always return same type ipfs.add should always return same type Oct 19, 2015
@dignifiedquire
Copy link
Contributor

👍

@victorb
Copy link
Contributor Author

victorb commented Oct 21, 2015

I see now that ipfs.add is not the only command that works this way. ipfs.object.data, ipfs.cat and ipfs.block.get would need to be fixed as well.

@daviddias
Copy link
Contributor

with the update to 0.3.8, IPFS started returning ndjson on the HTTP API instead of a JSON array, we need to update that on the node-ipfs-api

@daviddias
Copy link
Contributor

@victorbjelkholm can you confirm if this is still a problem this? The distinction between a stream and an object comes from go-ipfs itself, depending how the header is set:

https://github.com/ipfs/js-ipfs-api/blob/master/src/request-api.js#L63-L64

@dignifiedquire
Copy link
Contributor

According to the tests this should now happen, and will be available for everyone when ipfs/kubo#1979 is merged and released. @victorbjelkholm can you confirm please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants