Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lucy-dirsum

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucy-dirsum

Create an md5 digest of all content inside a directory. Uses streams to avoid reading all data in memory.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

Lucy dirsum Build Status

Create an md5 digest of all content inside a directory.

Part of Lucidity project.

Installation

npm install lucy-dirsum --save

dirsum ( path, callback, ignoreFunction )

Returns an (async) md5 digest of all content inside a directory. The ignore function can be used to ignore files. It receives a local path to directory and filename. For example, scanning '/some/directory', the file '/some/directory/foo/bar.txt' is checked by calling the ignore function with ( 'foo/bar.txt', 'bar.txt' ). Returning true ignores the file. Default ignore function is to ignore files starting with a dot ('.').

The hashing algorithm includes file names (and thus detects empty directory and file move) and does not read large files in memory (it uses read streams). Speed is directly proportional to fs.createReadStream (36s for 12G of data on i7 cpu).

Usage example

const dirsum = require ( 'lucy-dirsum' )

dirsum
( '/some/directory'
, function ( err, digest )
  { if ( err )
    { // ...
    }
    else
    { console.log ( `Hex digest for '/some/directory' is '${ digest }'.` )
    }
  }
, function ( path, filename )
  { return /^\./.exec ( filename )
        || /^info\.txt/.exec ( path ) // ignore info.txt at root
  }
)

Tests

 npm test

Contributing

Please use 'jessy style'.

Add unit tests for any new or changed functionality.

Release History

  • 0.1.1 (2015-09-22) Fixed npm readme.
  • 0.1.0 (2015-09-22) Initial release.

Keywords

FAQs

Package last updated on 22 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc