Skip to content
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

Sample code for block api #12

Closed
travisperson opened this issue Dec 11, 2015 · 2 comments
Closed

Sample code for block api #12

travisperson opened this issue Dec 11, 2015 · 2 comments

Comments

@travisperson
Copy link
Member

repo.blocks.read('12200007d4e3a319cd8c7c9979280e150fc5dbaae1ce54e790f84ae5fd3c3c1a0475', function (buff, err) {
  console.log(err)
})

While this basically works as intended (to print out the data of the block), the variable names are confusing and probably should be switched.

repo.blocks.write(buff, function (buff, err) {
  console.log(buff.toString('utf-8'), err)
})
@travisperson travisperson changed the title Sample code for block read Sample code for block api Dec 11, 2015
@daviddias
Copy link
Member

We are following the Node.js pattern of "err first, results last" with (err, res). Not sure if I understand why that is particularly confusing.

Btw, this js-ipfs-repo is in flux still :) We now have locks and version working following the new structured presented at #9 (comment)

@daviddias
Copy link
Member

Got what you were saying, fixed the README :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants