ipfs-web3storage-cid
v1.0.5
Published
Get the IPFS CID from a file (Same CID as that generated by Web3.Storage)
Downloads
14
Maintainers
Readme
ipfs-web3storage-cid
Takes a file buffer and returns the IPFS CID v1 (Same as that generated by Web3.Storage)
A better way to name files and have it compatible with IPFS / Web3.Storage CIDs. Generally prefer this method over generating random UUIDs.
Install
# install it as a dependency
$ npm i ipfs-web3storage-cid
Usage
import fs from 'fs';
import { getCID } from 'ipfs-web3storage-cid';
const buffer = fs.readFileSync('./demo.jpg');
const cid = await getCID(buffer);
console.log(cid);