-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reading data via object get vs. cat vs. object data #4115
Comments
TL;DR, you probably don't want to use the IPFS files are stored in DagProtobuf IPLD nodes with the following format: {
"data": [bytes],
"links": [ link1, link2, link3 ] // Links to other IPLD nodes.
} In IPFS, the "data" field is usually another protocol buffer (encoded into raw bytes). So, what's happening here?
|
Thanks so much for your explanation. Sorry I wanted to reply earlier.. The discussion is kind of hard to follow
Is it correct that in the future we could use dag abi, with either CBOR or EJSON that would have better support for binary? https://github.com/ipfs/ipfs/blob/master/IMPLEMENTATION_STATUS.md#dag Should I close this issue, duplicate of #1582 ? |
I agree, sorry about that.
Yes. The object API will eventually be replaced with the dag API anyways. Here is the latest state of things: https://github.com/ipfs/interface-ipfs-core/issues/81#issuecomment-322756354 However, for what you're doing, you probably want to just use
Yes. All of these issues are known issues, it's just a simple matter of fixing them 😄. |
thanks a lot! |
Version information:
using Nodejs v6.11.0
ipfs-api@14.1.1
Type:
bug
Severity:
High?
Description:
trying to read the data of a PNG (38,994 bytes) in nodejs via js-ipfs-api and go-ipfs.
observations:
api.object.get
returns a JSON object with a 'data' property containing a buffer with 72014 elements.api.object.data
returns a buffer with 39004api.cat
concating all chunks of the stream into a single buffer gives 38994 (correct!)questions:
api.object.get
and why is it so big?api.object.data
seems to have a few bytes in frontresult.slice(6)
seems to give the correct start, but I am unsure what to cut off the endThis is probably related to
ipfs object get
transform bytes > 127 into U+FFFD (replacement character �) #2454Slicing off data (off the start/end) seems wrong and might break in the future if this is fixed. Any suggestion is appreciated.
Currently I try to
The text was updated successfully, but these errors were encountered: