Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

often/csum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

Calculate the checksum of a file using JavaScript.

API documentation

The file csum.js exports one function called csum that takes two arguments: file and algorithm (default: SHA-256)

You must pass a File object to the file argument, and regarding the algorithm argument, you must pass a supported algorithm.

Once called, if everything is ok, it returns a string (the calculated file hash hex). If everything is not ok, it throws an error.

Usage

<input type='file' />
import { csum } from 'https://often.github.io/csum/csum.js'
const input = document.querySelector('input')
input.addEventListener('change', async () => {
 const [file] = input.files
 console.log(file.name, await csum(file))
})

Installation

npm i csum

License

AGPL-3.0

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /