Just enough code to calculate the IPFS hash for some data
npm install 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. Try it out with npx:
```
npx ipfs-only-hash
`sh`
npm i ipfs-only-hash
From the command line
`sh
ipfs-only-hash
As a library
`js
const Hash = require('ipfs-only-hash')
const data = 'hello world!'
const hash = await Hash.of(data)
console.log(hash) // QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j
`API
`js
const Hash = require('ipfs-only-hash')
`$3
Calculate the hash for the provided input.
*
input (string|Uint8Array|AsyncIterable): 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.Feel free to dive in! Open an issue or submit PRs.
MIT © Alan Shaw