1

I have a cid returned by ipfs.add api, and i want get the file(image) but i can't restore the picture even i can get the Uint8Array, and I have read the api docs, but i still can't get it.

I want to know how to manipulate data to recover my picture or just get the pic using cid.

here is my code

    let chunks = '';
    const cid = 'something hash';

    for await (const buf of ipfs.get(cid)) {
        chunks += buf;
    }
    fs.writeFileSync('./img.jpg', chunks);

0 Answers0