# file-to-sha1

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

Latest version **0.0.1** (published 2018-12-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install file-to-sha1
pnpm add file-to-sha1
yarn add file-to-sha1
bun add file-to-sha1
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-12-28 |
| First published | 2018-12-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Dimitar Nestorov |
| Maintainers | dimitarnestorov |
| Keywords | sha1, blob, file, path, data, string, buffer, checksum, hash, hex, base64, crypto |

## Links

- npm: https://www.npmjs.com/package/file-to-sha1
- Repository: git@github.com:dimitarnestorov/file-to-hash
- Homepage: https://github.com/dimitarnestorov/file-to-hash/tree/master/packages/file-to-sha1
- npm.io page: https://npm.io/package/file-to-sha1

## Dependencies (3)

- [blob-to-sha1](https://npm.io/package/blob-to-sha1.md) ^0.0.1
- [data-to-sha1](https://npm.io/package/data-to-sha1.md) ^0.0.1
- [path-to-sha1](https://npm.io/package/path-to-sha1.md) ^0.0.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2018-12-28

## README

# file-to-sha1

> Calculates a SHA-1 of a given file

## Install

Using yarn:
```sh
yarn add file-to-sha1
```

or using npm:
```sh
npm install file-to-sha1
```

## Usage in the browser
```javascript
import { blobToSHA1 } from 'file-to-sha1'

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

## Usage in node

### For file paths
```javascript
const { pathToSHA1 } = require('file-to-sha1')

const hash = await pathToSHA1('/path/to/file')
```

### For buffers or strings
```javascript
const fs = require('fs')
const { dataToSHA1 } = require('file-to-sha1')

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

const hash = dataToSHA1(buffer)
```

---
_Source: https://npm.io/package/file-to-sha1 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
