Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

CLI - add block put flags and block get CID support #652

Merged
merged 8 commits into from
Dec 10, 2016

Conversation

kumavis
Copy link
Contributor

@kumavis kumavis commented Dec 10, 2016

This adds flags to the jsipfs block put <hash> command

  • format (f)
  • mhtype
  • mhlen

these commands and their descriptions are based on go-ipfs https://github.com/ipfs/go-ipfs/blob/2aded6785dca9b8ce27595a9698d38ce993cbc5e/core/commands/block.go#L118-L121

This also adds support for CIDs in ipfs block get <cid> and fixes the output of binary data

@jbenet jbenet added the status/in-progress In progress label Dec 10, 2016
console.log(block.data.toString())
// writing the buffer to stdout seems to be the only way
// to send out binary data correctly
process.stdout.write(block.data)
Copy link
Member

Choose a reason for hiding this comment

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

👍

mhlen: {
describe: 'multihash hash length',
default: undefined
}
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we resolved this in the chats.
answer: why? idk, its in the spec

if (err) return cb(err)
mhash = _mhash
cb()
}
Copy link
Member

Choose a reason for hiding this comment

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

since you are doing waterfall, you can pass the cb directly to the block.key function and capture the hash in the waterfall sequence

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right - i previously needed the reference elsewhere, but that got factored out. will clean up.

@kumavis kumavis changed the title CLI - block put flags CLI - add block put flags and block get CID support Dec 10, 2016
Copy link
Member

@daviddias daviddias left a comment

Choose a reason for hiding this comment

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

sweet! Thank you @kumavis. I've fetched and tested the changes, all tests pass, perfect 👌🏽

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.

3 participants