Socket
Socket
Sign inDemoInstall

sha1-file

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sha1-file

return an sha1sum of a given file


Version published
Maintainers
1
Install size
4.00 kB
Created

Readme

Source

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.

Keywords

FAQs

Last updated on 14 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc