# dint

> Generate and verify directory integrity

Latest version **5.1.0** (published 2021-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install dint
pnpm add dint
yarn add dint
bun add dint
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.1.0 |
| Published | 2021-02-12 |
| First published | 2017-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Zoltan Kochan |
| Maintainers | zkochan |
| Keywords | integrity, sri, directory, fs |

## Links

- npm: https://www.npmjs.com/package/dint
- Repository: https://github.com/zkochan/dint
- Homepage: https://github.com/zkochan/dint#readme
- Issues: https://github.com/zkochan/dint/issues
- npm.io page: https://npm.io/package/dint

## Dependencies (3)

- [ssri](https://npm.io/package/ssri.md) ^8.0.0
- [p-every](https://npm.io/package/p-every.md) ^2.0.0
- [p-limit](https://npm.io/package/p-limit.md) ^3.0.0

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

- 5.1.0 (latest) — 2021-02-12
- 5.0.0 (next) — 2020-06-06
- 4.0.2 — 2020-02-19
- 4.0.1 — 2019-09-18
- 4.0.0 — 2019-03-15
- 3.0.2 — 2018-08-14
- 3.0.1 — 2018-06-14
- 3.0.0 — 2018-05-13
- 2.0.2 — 2018-01-20
- 2.0.1 — 2018-01-20
- 2.0.0 — 2017-12-05
- 1.0.0 — 2017-06-12
- 0.0.0 — 2017-06-11

## README

# dint

> Generate and verify directory integrity

<!--@shields('npm', 'travis')-->
[![npm version](https://img.shields.io/npm/v/dint.svg)](https://www.npmjs.com/package/dint) [![Build Status](https://img.shields.io/travis/zkochan/dint/master.svg)](https://travis-ci.org/zkochan/dint)
<!--/@-->

This package is mostly a copy/paste from [@zkat](https://github.com/zkat)'s [cadr](https://github.com/zkat/cadr) excluding the [cacache](https://github.com/zkat/cacache) usages.

**Important!** A directory is not considered modified if a file was added.
A directory is considered modified if a file was modified or removed.

## Installation

```sh
npm i -S dint
```

## API

### `from(dirname): Promise<DirectoryIntegrity>`

Returns a mapping of file names to size and [Subresource Integrity](https://w3c.github.io/webappsec-subresource-integrity/) of each file.

Result example:

```js
{
 'test/fixtures/4/lib/bar.js':
   { generatingIntegrity: Promise<'sha512-1B0QjibzjRrYeSf79Hcy9T1t8KNt4cFpz//88geXTN6lDnUzMo+4o/MJDESUs884XdZ5EX4RLdzsJA8qeEV3lg=='>,
     size: 198 },
  'test/index.js':
   { generatingIntegrity: Promise<'sha512-X6ypBcefaTDbDHHcR0J57E2dvDv6vAVi7tHAhfDImmDU8LBaYwdkdX+hVlqFdWNevJjRqsgZbXb/c+Ewq5t3tQ=='>,
     size: 939 } }
```

### `check(dirname, directoryIntegrity): Promise<Boolean>`

Verifies directory integrity against a `directoryIntegrity` argument.

E.g.:

```js
check('dirname', {
 'test/fixtures/4/lib/bar.js':
   { integrity: 'sha512-1B0QjibzjRrYeSf79Hcy9T1t8KNt4cFpz//88geXTN6lDnUzMo+4o/MJDESUs884XdZ5EX4RLdzsJA8qeEV3lg==',
     size: 198 },
  'test/index.js':
   { integrity: 'sha512-X6ypBcefaTDbDHHcR0J57E2dvDv6vAVi7tHAhfDImmDU8LBaYwdkdX+hVlqFdWNevJjRqsgZbXb/c+Ewq5t3tQ==',
     size: 939 } })
```

## License

[MIT](./LICENSE) © [Zoltan Kochan](http://kochan.io)

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