JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 93241
  • Score
    100M100P100Q154346F
  • License MIT

return an sha1sum of a given file

Package Exports

  • sha1-file

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sha1-file) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sha1-file

NPM version Build status License Code style

Simply return an sha1 sum of a given file. If using async version (by including callback), it will stream; successfully tested on files 4 GB+.

Installation

$ npm install --save sha1-file

Usage

sha1File(path, [callback])

const sha1File = require('sha1-file')

// sync (no callback)

sha1File('./path/to/a_file') // 'c8a2e2125f94492082bc484044edb4dc837f83b'

// async/streamed (if using callback)

sha1File('./path/to/a_file', function (error, sum) {
  if (error) {
    console.log(error)
  }

  console.log(sum) // 'c8a2e2125f94492082bc484044edb4dc837f83b'
})

Caveats

When using the sync version (excluding the callback), you will be limited to a filesize of 2GB (1GB on 32-bit platforms), this is due to a V8 restriction, see this issue for more details.