-
Notifications
You must be signed in to change notification settings - Fork 1.2k
CLI - add block put
flags and block get
CID support
#652
Conversation
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) |
There was a problem hiding this comment.
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 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whyrusleeping in what case is mhlength used ?
There was a problem hiding this comment.
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() | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
block put
flags and block get
CID support
There was a problem hiding this 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 👌🏽
This adds flags to the
jsipfs block put <hash>
commandformat
(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