-
Notifications
You must be signed in to change notification settings - Fork 124
Proposal for Standardising API that can return buffered results vs Node.js Streams vs Pull Streams #126
Comments
@ipfs/javascript-team I believe you all might want to chime on this. |
👍 for proposal b from my side, not sure about the names and naming is hard so go ahead with these :) |
I am for option b, what about
? |
@dignifiedquire @nicola thank you for the feedback! With regards to the naming. I don't have strong feelings about 'catPStream' and 'catNStream', I kind of like @nicola suggestion. The only that feels weird to me from all the options shared was: 'catPull' without the 'Stream' keyword. |
Yeah, @nicola's suggestion makes sense to me too. Divide the methods would be the most beneficial and least confusing (more arguments/options for a function, the less intuitive). Also, regarding the naming, using full names like |
We need to provide this change the sooner the better. Streams are still confusion for devs. One thing to consider is to We also should consider aliases
|
The short names are reeeeaally hard to distinguish with |
Not sure |
Maybe we could do // callback
files.cat(cid, callback)
// node stream
files.cat(cid)
// pull streams
files.catPull(cid) It's easy to detect argument count and this might make it a bit less awkward to find correct names |
Ok, let's ship this for js-ipfs 0.27.0. The resolution is: Expose 3 higher level calls for streaming methods (cat used as example):
This will unlock use cases with perf improvements as shown in ipfs/js-ipfs#988 |
Oh I missed promises in my proposal.. |
Pushed at the same time. Reviewing your proposal, @dignifiedquire There is a reason why it doesn't work. The other reason to call it ReadableStream and not Node.js Stream is that somehow ReadableStream and Node.js Stream have diverged (and we have caught bugs because of that, i.e isStream vs is-stream). So let's talk of ReadableStream as the Type/Class https://www.npmjs.com/package/readable-stream |
I wonder if it wouldn't be better to have sth like
that way we could keep smaller bundles and easier names |
re: #126 (comment) Eventually, we will have ES6 Imports and I prefer waiting for that then yet having to explain to users that they have to require ipfs in different ways to get a different API. |
I would suggest then going with |
Work happening here #162 |
🚢 |
I'll make this proposal and succinct as possible, with the hopes we can get around it asap.
Our current needs and requirements:
Essentially we have two options on the table
a) Use option arguments to specify what we are looking for
b) Use different method names
This option has a couple of advantages:
ipfs.files.catNStream(cid).pipe(process.stdout)
without going into callback. (The reason why we had to return a stream in a callback, was because of Promises, but that stays onipfs.files.cat
only.Once this proposal goes forward we need to:
getStream
, to begetPStream
.The text was updated successfully, but these errors were encountered: