0.0.13 • Published 6 months ago

simple-recursive-checksum v0.0.13

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

simple-recursive-checksum

npm.io Known Vulnerabilities

Simple checksum determination for files or folders

A simple pure Javascript tool to get a checksum of a single file or of an entire folder.

For a single file this will use the crypto module to get a hash of the file's contents. For a directory, it will recursively get the folder's file hashes (with the files sorted in alphabetical order). This is not standard in any way, but is very useful nonetheless.

Installation

npm install simple-recursive-checksum

Usage

const { checksumFile, checksumDirectory } = require("simple-recursive-checksum");

async function main() {
    const fileHashMd5 = await checksumFile("my_file.txt");
    const fileHashSha256 = await checksumFile("my_file.txt", "sha256");

    const directoryHashMd5 = await checksumDirectory("folder_name");
    const directoryHashSha256 = await checksumDirectory("folder_name", "sha256");

    console.log(fileHashMd5, fileHashSha256, directoryHashMd5, directoryHashSha256);

    return "Done";
}

main()
    .then(console.log)
    .catch(console.error);
0.0.13

6 months ago

0.0.12

9 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago