-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ipfs.get() with CIDv1 does not fetch content #2696
Comments
Hmm from tests in |
Hey I have a similar issue. I was going through the js-ipfs/example/ipfs-101. In the example ipfs.get is not discussed. Still I tried to write get like this. "Hello, how are you today? Welcome to the Distributed Web!" const IPFS = require('ipfs') async function main () { const fileBuffer = await node.cat(filesAdded[0].hash) ## viewing the file const myobj = await node.get(filesAdded[0].hash) ## should get the file } |
What's happening here is a series of unfortunate events:
This will be fixed by ipfs-inactive/js-ipfs-unixfs-importer#49 which ignores The data is there and is fetchable though: const all = require('it-all')
const last = require('it-last')
it('js-ipfs should work', async () => {
const { cid } = await last(ipfs.add(Buffer.from('hello world'), { cidVersion: 1 }))
console.log('CID: ', cid)
const content = Buffer.concat(await all(ipfs.cat(cid)))
expect(content.toString()).to.equal('hello world')
})
|
I see, thanks @achingbrain for the detective work! |
I'll close this then. @kuabhish your problem seems unrelated - can you please post a question on https://discuss.ipfs.io/c/help |
Type: Bug
Severity: High
Description:
Retrieving CIDv1 returns
type: dir
and no content.Steps to reproduce the error:
Output of the former test:
The text was updated successfully, but these errors were encountered: