Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion daemon-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function main () {
}

const cid = await client.dag.put(data, {
format: 'dag-test',
storeCodec: 'dag-test',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is currently broken but I want to illustrate the breakage here - when connecting via the http client, you now can't use the DAG PUT API to put arbitrary bytes. I don't believe you could do this even before 0.10.0 with go-ipfs, it only worked with js-ipfs because the http server just invokes the BLOCK PUT API instead. Now, you need to have the codec on the server in both js-ipfs and go-ipfs for this to work, otherwise use the BLOCK PUT API directly.

Ref: ipfs/js-ipfs#3917

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking that this should be changed to client.block.put to illustrate how to do this correctly with a custom codec, thoughts?

Copy link
Contributor

@achingbrain achingbrain Oct 15, 2021

Choose a reason for hiding this comment

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

The http client doesn't use dag.get either since the server has to serialize the output to transfer it over HTTP, instead it uses block.get internally while presenting the same API as core.

dag.put in the client should now probably do the same thing to maintain API compatibility, otherwise the DAG API becomes completely unusable over HTTP, which you might not even know you are using as a transport (eg: there's a daemon running as a background process and you are using the CLI to interact with it).

This example might be a good place to show how to put/get dag objects using the block API as well as the DAG API though.

hashAlg: 'sha2-256'
})

Expand Down
2 changes: 1 addition & 1 deletion in-process-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function main () {
}

const cid = await node.dag.put(data, {
format: 'dag-test',
storeCodec: 'dag-test',
hashAlg: 'sha2-256'
})

Expand Down