https://github.com/nichoth/multihash
Create hashes in browsers
https://github.com/nichoth/multihash
Last synced: about 1 year ago
JSON representation
Create hashes in browsers
- Host: GitHub
- URL: https://github.com/nichoth/multihash
- Owner: nichoth
- Created: 2022-06-17T17:11:03.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-11T00:30:54.000Z (over 1 year ago)
- Last Synced: 2025-03-24T06:22:13.403Z (over 1 year ago)
- Language: JavaScript
- Size: 916 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# multihash
Create path & URL safe hashes of files. Suitable for use in a browser.
Inspired by [ssbc/multiblob](https://github.com/ssbc/multiblob), but this
deals only with a `blob -> filename` interface, not storage of blobs.
## install
```
npm i -S @nichoth/multihash
```
## example
```js
const fs = require('fs')
const { getHash } = require('@nichoth/multihash')
const pic = fs.readFileSync(__dirname + '/cinnamon-roll.jpg')
const hashName = getHash(pic)
console.log('hash name', hashName)
// => hash name 1e8d57856d9da786cd24b66b624bab64fc65521aab9270ff52efe70e9f8a9cc8
```
--------------------------------------
## bundle size
```
total 16
-rw-r--r-- 1 nick staff 469B Jan 10 17:39 index.cjs
-rw-r--r-- 1 nick staff 576B Jan 10 17:39 index.mjs
```