Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including recursive-sha256 with all npm packages installed. Try it out:

var recursiveSha256 = require("recursive-sha256")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

recursive-sha256 v1.0.1

Functions to return sha256 of folder contents or files or just what has changed

recursive-sha256 1.0.1



Provide the capability to recurse through a directory structure and either return checksums of all contents
or tell you which specific files have changed since last time.
 
State is maintained in a local sqlite3 database


Usage:

    var recursiveSHA256 = require('recursive-sha256').rsha256;
    var changed_files   = require('recursive-sha256').changed_files;
    var totalhash       = require('recursive-sha256').totalhash; 

    //
    // Get the SHA256 of a single file
    recursiveSHA256('./index.js', function (err, res) {
        console.log('Testing a single file...');
        console.log(res);
    });

    //
    // Get the SHA256 of everything in a folder
    recursiveSHA256('./tests', function (err, res) {
        console.log('Testing a folder...');
        console.log(res);
    });

    //
    // Return the SHA256 of all the hashes of all files in a folder ( a single hash code for everything is returned ) 
    totalhash('./', function (err, res) {
        console.log('getting total hash for ./');
        console.log(JSON.stringify(res, null, 2));
    });

    //
    // Return a list of files that have changed since the last run
    changed_files('./', function (err, res) {
        console.log('getting files that have changed under ./');
        console.log(JSON.stringify(res, null, 2));
    });

LOG:
~~~~~~~~~~~~~~~
    1.0.1 - Tried to fix the documentation formatting
    1.0.0 - initial release 


Shameless plug
~~~~~~~~~~~~~~~
https://allthethin.gs

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free