0.2.0 • Published 4 years ago

@timhall/fingerprint v0.2.0

Weekly downloads
357
License
MIT
Repository
github
Last release
4 years ago

@timhall/fingerprint

Calculate a hash fingerprint for directories and files.

const { fingerprintDir } = require('@timhall/fingerprint');

// Calculate a fingerprint of the current working directory using
// - filter = active .gitignore files
// - algorithm = sha1
// - encoding = base64
const a = await fingerprintDir(process.cwd());
const { fingerprintDir, fingerprintFile } = require('@timhall/fingerprint');
const { join } = require('path');

const b = await fingerprintDir(process.cwd(), {
  algorithm: 'sha256',
  encoding: 'hex',
  filter: absolutePath => /^\./.test(absolutePath)
});

const c = await fingerprintFile(join(__dirname, 'file.txt'));

fingerprintDir(dir: string, options): Promise

Options:

fingerprintFile(file: string, options): Promise

Options: