# nodejs-md5

> Gets md5 of file or folder

Latest version **1.1.0** (published 2018-05-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install nodejs-md5
pnpm add nodejs-md5
yarn add nodejs-md5
bun add nodejs-md5
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-05-14 |
| First published | 2015-10-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Trevor Heins |
| Maintainers | heinst |
| Keywords | md5, file, string |

## Links

- npm: https://www.npmjs.com/package/nodejs-md5
- Repository: https://heinst@github.com/heinst/nodejs-md5
- Homepage: https://github.com/heinst/nodejs-md5#readme
- Issues: https://github.com/heinst/nodejs-md5/issues
- npm.io page: https://npm.io/package/nodejs-md5

## Dependencies (2)

- [fs](https://npm.io/package/fs.md) latest
- [exceptions](https://npm.io/package/exceptions.md) latest

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-05-14
- 1.0.2 — 2016-10-27
- 1.0.1 — 2016-10-18
- 1.0.0 — 2016-10-17
- 0.6.0 — 2015-10-14
- 0.5.1 — 2015-10-13
- 0.5.0 — 2015-10-13
- 0.2.1 — 2015-10-06
- 0.2.0 — 2015-10-06

## README

# nodejs-md5  ![Version][version] [![Build Status](https://travis-ci.org/heinst/nodejs-md5.svg)](https://travis-ci.org/heinst/nodejs-md5) ![Coverage Status][coveralls] ![Total Downloads][total]

A simple node module to give you the MD5 of a file or string.
Mimics the macOS command `md5`.

## To install:

```bash
npm install nodejs-md5
```

## To import:

```JavaScript
var md5 = require("nodejs-md5");
```

## Example Usage:

#### To get the MD5 of a file:

```JavaScript
//md5 ./test/testfile.txt
md5.file("./test/testfile.txt", function(err, md5) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5); //"MD5 (testfile.txt) = f0ffb8dbde05931dfb9baeee5c86b214"
    }
});
```

```JavaScript
//md5 -q ./test/testfile.txt
md5.file.quiet("./test/testfile.txt", function(err, md5) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5); //'f0ffb8dbde05931dfb9baeee5c86b214'
    }
});
```

```JavaScript
//md5 -r ./test/testfile.txt
md5.file.quiet("./test/testfile.txt", function(err, md5) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5); //'f0ffb8dbde05931dfb9baeee5c86b214 file.txt'
    }
});
```

#### To get the MD5s of multiple files in one shot:

```JavaScript
//md5 ./test/testfile.txt ./test/anotherTestFile.txt
md5.files(["./test/testfile.txt", "./test/anotherTestFile.txt"], function(err, md5s) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5s); //[ 'MD5 (testfile.txt) = f0ffb8dbde05931dfb9baeee5c86b214', 'MD5 (anotherTestFile.txt) = 59a8935a0ac35991c27f29d4f25ea8b9' ]
    }
});
```

```JavaScript
//md5 -q ./test/testfile.txt ./test/anotherTestFile.txt
md5.files.quiet(["./test/testfile.txt", "./test/anotherTestFile.txt"], function(err, md5s) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5s); //[ 'f0ffb8dbde05931dfb9baeee5c86b214', '59a8935a0ac35991c27f29d4f25ea8b9' ]
    }
});
```

```JavaScript
//md5 -r ./test/testfile.txt ./test/anotherTestFile.txt
md5.files.reverse(["./test/testfile.txt", "./test/anotherTestFile.txt"], function(err, md5s) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5s); //[ 'f0ffb8dbde05931dfb9baeee5c86b214 file.txt', '59a8935a0ac35991c27f29d4f25ea8b9 file.txt' ]
    }
});
```

#### To get the MD5 of a string:

```JavaScript
//md5 -s "Hello, world"
md5.string("Hello, world", function (err, md5) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5); //'MD5 ("Hello, world") = bc6e6f16b8a077ef5fbc8d59d0b931b9'
    }
});
```

```JavaScript
//md5 -qs "Hello, world"
md5.string.quiet("Hello, world", function (err, md5) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5); //"bc6e6f16b8a077ef5fbc8d59d0b931b9"
    }
});
```

```JavaScript
//md5 -rs "Hello, world"
md5.string.reverse("Hello, world", function (err, md5) {
    if (err) {
        console.log(err);
    }
    else {
        console.log(md5); //'bc6e6f16b8a077ef5fbc8d59d0b931b9 "Hello, world"'
    }
});
```
## Contribution welcome!

If you would like to improve on this library, fork it, branch it, pull request it!

[coveralls]: https://img.shields.io/coveralls/heinst/nodejs-md5.svg
[total]: https://img.shields.io/npm/dt/nodejs-md5.svg
[version]: https://img.shields.io/npm/v/nodejs-md5.svg

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