5.1.0 • Published 3 years ago

dint v5.1.0

Weekly downloads
588
License
MIT
Repository
github
Last release
3 years ago

dint

Generate and verify directory integrity

npm version Build Status

This package is mostly a copy/paste from @zkat's cadr excluding the 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

npm i -S dint

API

from(dirname): Promise<DirectoryIntegrity>

Returns a mapping of file names to size and Subresource Integrity of each file.

Result example:

{
 '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.:

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 © Zoltan Kochan

5.1.0

3 years ago

5.0.0

4 years ago

4.0.2

4 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

7 years ago

0.0.0

7 years ago