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
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.