-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
README.md
Outdated
|
|
||
| Creates a new block with raw data `data`. `type` can be either `'protobuf'` or `'ipld'`. | ||
|
|
||
| #### `Block.create(data, key, [type, ] callback)` |
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.
Let's just go ahead and take from #5 the fact that .key becomes a function and make it an async function.
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.
@diasdavid done, please review the new api before I start propagating
package.json
Outdated
| }, | ||
| "homepage": "https://github.com/ipfs/js-ipfs-block#readme", | ||
| "devDependencies": { | ||
| "aegir": "^8.0.0", |
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.
update to latest
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.
🛎
|
API looks good, needs:
|
fa9a47f to
41fd06b
Compare
41fd06b to
7941631
Compare
daviddias
left a comment
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.
Overall LGTM
README.md
Outdated
| - [`block.data`](#blockdata) | ||
| - [`block.key`](#blockkey) | ||
| - [`block.extension`](#blockextension) | ||
| - [`block.key([hashFn,] callback)`](#blockkeyhashfn-callback) |
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.
s/hashFn/hashAlg
README.md
Outdated
|
|
||
| The [multihash][multihash] of the block's data, as a buffer. | ||
|
|
||
| #### `block.key([hashFn,] callback)` |
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.
s/hashFn/hashAlg
| set () { | ||
| throw new Error('Tried to change an immutable block') | ||
| } | ||
| }) |
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.
👍
src/index.js
Outdated
|
|
||
| multihashing(this.data, hashFunc, callback) | ||
| if (this._cache[hashFunc]) { | ||
| setImmediate(() => { |
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.
setImmediate isn't supported by FF or Chrome, will it be a problem?
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.
hmm thanks for pointing this out, need to find a better solution :(
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.
setImmediate is also used in 4 different places across the codebase. There is also polyfill for it if it comes to it.
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.
yeah we were shipping one before, but not anymore. As we already use async I'm going to use async.setImmediate http://caolan.github.io/async/docs.html#setImmediate
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.
fixed
b9f4187 to
488d68c
Compare
BREAKING CHANGE:
Constructor requires a hash now and there is now Block.create(data, type, cb)