Wondering what’s next for npm?Check out our public roadmap! »

    fsnap

    1.2.1 • Public • Published

    fsnap

    Linux Build Status Windows Build status Dependency Status devDependency Status

    Diff filesystem snapshot results. Useful for file watch system.

    Install

    npm install --save fsnap

    Usage

    const fsnap = require('fsnap');
     
    let s1 = fsnap.create(path);
    let s2 = fsnap.create(path);
    let result = fsnap.diff(s1, s2);
     
    // do something...
    console.log(result.deletes);
    console.log(result.changes);
    console.log(result.creates);

    API Reference

    Methods

    fsnap.create(patterns, [options])

    • patterns string|Array - See supported minimatch patterns.
    • options object - See the node-glob options.

    create snapshot from the given patterns.

    fsnap.diff(s1, s2)

    • s1 object - snapshot 1
    • s2 object - snapshot 2

    Returns object

    • deletes array - path list of deleted files and directories.
    • creates array - path list of created files and directories.
    • chagnes array - path list of changed files and directories.

    fsnap.simplify(result)

    • result object - the result of fsnap.diff

    Simplify the diff result by remove files contains in the directory in the same result.

    License

    MIT © 2017 Johnny Wu

    Keywords

    Install

    npm i fsnap

    DownloadsWeekly Downloads

    28

    Version

    1.2.1

    License

    MIT

    Last publish

    Collaborators

    • avatar