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

fix hashes in examples #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix hashes in examples #7

wants to merge 1 commit into from

Conversation

slothbag
Copy link

No description provided.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 62bef57 on slothbag:master into 4bf0d7e on SilentCicero:master.

@justinmchase
Copy link

justinmchase commented Oct 13, 2018

I came here to say this but the code comments should be fixed too, also you shouldn't fetch the results synchronously when the put hasn't completed yet, more like this:

import IPFS from 'ipfs-mini'

const ipfs = new IPFS({ 
  host: 'localhost',
  port: 5001,
  protocol: 'http'
});
 
ipfs.add('hello world!', (err, result) => {
  // result null 'QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j'
  console.log(err, result);

  ipfs.cat('QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j', (err, result) => {
    // result null 'hello world!'
    console.log(err, result);
  });
});

ipfs.addJSON({ somevalue: 2, name: 'Nick' }, (err, result) => {
  // result null 'QmYzWWCvYhqU6d5VvRvVwgbpqM9J3HH8TMbns9UvFSSvBf'
  console.log(err, result);

  ipfs.catJSON('QmYzWWCvYhqU6d5VvRvVwgbpqM9J3HH8TMbns9UvFSSvBf', (err, result) => {
    // result null, { somevalue: 2, name: 'Nick' }
    console.log(err, result);
  });
});

Also, I had to switch to http.

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

Successfully merging this pull request may close these issues.

3 participants