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

ipfs.files.get throws error on multiaddr #430

Closed
somebody1234 opened this issue Aug 22, 2016 · 10 comments
Closed

ipfs.files.get throws error on multiaddr #430

somebody1234 opened this issue Aug 22, 2016 · 10 comments
Labels
kind/support A question or request for support

Comments

@somebody1234
Copy link

I'm using ipfs = new IPFS() to initialize, and when I use ipfs.files.get with a multiaddr it rejects the Promise with Error: not valid multihash. I'm not exactly sure what I'm doing wrong.

@daviddias
Copy link
Member

You are using it with a multiaddr and not a multihash?

@daviddias daviddias added the kind/support A question or request for support label Aug 22, 2016
@somebody1234
Copy link
Author

somebody1234 commented Aug 22, 2016

@diasdavid Yes, and the api says I can use a multiaddr

@daviddias
Copy link
Member

Ups, its a typo, sorry about that @somebody1234 -- ipfs-inactive/interface-js-ipfs-core@dad7f81

@somebody1234
Copy link
Author

somebody1234 commented Aug 22, 2016

Okay, how would I get a file by filename?

@somebody1234
Copy link
Author

Also, I'm using the multihash format shown in the API and I'm still getting an error saying it's not a valid multihash

@daviddias
Copy link
Member

@somebody1234 could you provide a snippet on how to reproduce?

@somebody1234
Copy link
Author

Snippet:

const IPFS = require('ipfs'),
    ipfs = new IPFS();
ipfs.files.get('/ipfs/QmNhFJjGcMPqpuYfxL62VVB9528NXqDNMFXiqN5bgFYiZ1', (err, fole) => console.log(file)||file.content.pipe(process.stdout))

@daviddias
Copy link
Member

You need to init, load and start the node if you would like it to fetch data from other nodes.

One important question, where did you get that hash from?

@somebody1234
Copy link
Author

It's Neocities' hash, I was using it for testing

@daviddias
Copy link
Member

Got it, we don't have both networks connected (yet), so you won't be able to resolve hashes from go-ipfs in js-ipfs. This will change soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

2 participants