ipfs-only-hash
Just enough code to calculate the IPFS hash for some data
Calculate the IPFS hash for some data without having to install or run an IPFS node.
Install
npm i ipfs-only-hash
Usage
const Hash = require('ipfs-only-hash')
const data = Buffer.from('hello world!')
const hash = await Hash.of(data)
console.log(hash)
API
const Hash = require('ipfs-only-hash')
Hash.of(input, options?): Promise<string>
Calculate the hash for the provided input.
input
(Buffer|string|AsyncIterable<Buffer>
): The input bytes to calculate the IPFS hash for. Note that Node.js readable streams are async iterable!options
(Object
): Optional options passed directly to the ipfs-unixfs-importer
module. See the API docs for possible values.
Contribute
Feel free to dive in! Open an issue or submit PRs.
License
MIT © Alan Shaw