# ipfs-only-hash

> Just enough code to calculate the IPFS hash for some data

Latest version **4.0.0** (published 2021-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install ipfs-only-hash
pnpm add ipfs-only-hash
yarn add ipfs-only-hash
bun add ipfs-only-hash
```

Provides the command `ipfs-only-hash`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-03-26 |
| First published | 2019-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 139 |
| Author | Alan Shaw |
| Maintainers | alanshaw |
| Keywords | ipfs, hash, cid |

## Links

- npm: https://www.npmjs.com/package/ipfs-only-hash
- Repository: https://github.com/alanshaw/ipfs-only-hash
- Homepage: https://github.com/alanshaw/ipfs-only-hash#readme
- Issues: https://github.com/alanshaw/ipfs-only-hash/issues
- npm.io page: https://npm.io/package/ipfs-only-hash

## Dependencies (2)

- [meow](https://npm.io/package/meow.md) ^9.0.0
- [ipfs-unixfs-importer](https://npm.io/package/ipfs-unixfs-importer.md) ^7.0.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2021-03-26
- 3.0.0 — 2021-03-26
- 2.1.0 — 2021-03-26
- 2.0.1 — 2020-02-06
- 2.0.0 — 2020-02-04
- 1.0.2 — 2019-01-13
- 1.0.1 — 2019-01-13

## README

# ipfs-only-hash

[![Build Status](https://travis-ci.org/alanshaw/ipfs-only-hash.svg?branch=master)](https://travis-ci.org/alanshaw/ipfs-only-hash) [![dependencies Status](https://status.david-dm.org/gh/alanshaw/ipfs-only-hash.svg)](https://david-dm.org/alanshaw/ipfs-only-hash) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

> 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

```sh
npm i ipfs-only-hash
```

## Usage

From the command line

```sh
ipfs-only-hash <file>

# or pipe in 
echo "hello world" | 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')
```

### `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](https://github.com/ipfs/js-ipfs-unixfs-importer#api) for possible values.

## Contribute

Feel free to dive in! [Open an issue](https://github.com/alanshaw/ipfs-only-hash/issues/new) or submit PRs.

## License

[MIT](LICENSE) © Alan Shaw

---
_Source: https://npm.io/package/ipfs-only-hash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
