file-to-sha512

Calculates a SHA-512 of a given file. Single package for the browser and node.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
file-to-sha512
3190.0.14 years ago4 years agoMinified + gzip package size for file-to-sha512 in KB

Readme

file-to-sha512
Calculates a SHA-512 of a given file

Install

Using yarn:
yarn add file-to-sha512

or using npm:
npm install file-to-sha512

Usage in the browser

import { blobToSHA512 } from 'file-to-sha512'

const hash = await blobToSHA512(fileInput.files[0])

Usage in node

For file paths

const { pathToSHA512 } = require('file-to-sha512')

const hash = await pathToSHA512('/path/to/file')

For buffers or strings

const fs = require('fs')
const { dataToSHA512 } = require('file-to-sha512')

const buffer = fs.readFileSync('/path/to/file')

const hash = dataToSHA512(buffer)