instacode-hashing
v1.0.0
Published
Hashing utilities for InstaCode — MD5, xxHash64, and 3-part HTML component hashing
Maintainers
Readme
instacode-hashing
Hashing utilities for InstaCode — MD5, xxHash64, and 3-part HTML component hashing.
Install
npm install instacode-hashingUsage
const { hash, hashContent, hashFile, is3Path } = require('instacode-hashing');
// MD5 hash (uppercased)
hash('hello world');
// Smart hash — picks MD5 or xxHash64/3-part based on file type
hashContent('<div>hello</div>', 'component/app.html');
hashContent('body { color: red }', 'styles.css');
hashContent(Buffer.from('binary'), 'image.png');
// File-based hashing
await hashFile('component/app.html', { fsPath: '/path/to/app.html' });
// Check if a path uses 3-part hashing
is3Path('component/app.html'); // true
is3Path('styles.css'); // true
is3Path('image.png'); // falseAPI
hash(input) — MD5 hash, uppercased
vlineHash(content, ext, options?) — xxHash64 / 3-part hash for source files
is3Path(relPath, options?) — check if a path uses 3-part hashing
hashContent(content, relPath, options?) — smart dispatcher (MD5 vs xxHash64)
hashFile(relPath, options?) — async file-based hashing
hashFileSync(relPath, options?) — sync version of hashFile
createHash(path, size, deleted) — legacy hash from path+size+deleted
License
ISC
