sha1-from-file
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

sha1-from-file

Build Status npm

generate a short sha1 hash from a file's contents

install

npm install sha1-from-file --save

usage

import { createReadStream, readFileSync } from 'fs'
import hash, { sync } from 'sha1-from-file'
 
// async (ES6-)
hash(createReadStream('./file.txt')).then(myHash => ...)
 
// async (ES7)
const myHash = await hash(createReadStream('./file.txt'))
 
// sync (buffer)
const myHash = sync(new Buffer(...))
 
// sync (string)
const myHash = sync(readFileSync('./file.txt', 'utf-8')) // "1bhh17h"

Package Sidebar

Install

npm i sha1-from-file

Weekly Downloads

73

Version

2.0.1

License

CC-BY-4.0

Last publish

Collaborators

  • bcherny