Socket
Socket
Sign inDemoInstall

ipfs-only-hash

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-only-hash

Just enough code to calculate the IPFS hash for some data


Version published
Weekly downloads
13K
decreased by-5.3%
Maintainers
1
Weekly downloads
 
Created
Source

ipfs-only-hash

Build Status dependencies Status JavaScript Style Guide

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 <path to file>

Install

npm i ipfs-only-hash

Usage

From the command line

ipfs-only-hash <file>

# or pipe in 
echo "hello world" | ipfs-only-hash

As a library

const Hash = require('ipfs-only-hash')
const data = 'hello world!'
const hash = await Hash.of(data)
console.log(hash) // QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j

API

const Hash = require('ipfs-only-hash')

Hash.of(input, options?): Promise<string>

Calculate the hash for the provided input.

  • input (string|Uint8Array|AsyncIterable<Uint8Array>): 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

Keywords

FAQs

Package last updated on 26 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc