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

file-entry-cache

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-entry-cache - npm Package Compare versions

Comparing version 1.3.1 to 2.0.0

44

cache.js

@@ -17,2 +17,18 @@ var path = require( 'path' );

var removeNotFoundFiles = function removeNotFoundFiles() {
const cachedEntries = cache.keys();
// remove not found entries
cachedEntries.forEach( function remover( fPath ) {
try {
fs.statSync( fPath );
} catch (err) {
if ( err.code === 'ENOENT' ) {
cache.removeKey( fPath );
}
}
} );
};
removeNotFoundFiles();
return {

@@ -165,8 +181,8 @@ /**

* Sync the files and persist them to the cache
* @param [noPrune=false] {Boolean} whether to remove non visited/saved entries
* @method reconcile
*/
reconcile: function ( noPrune ) {
reconcile: function () {
removeNotFoundFiles();
var entries = normalizedEntries;
var keys = Object.keys( entries );

@@ -180,13 +196,21 @@

var cacheEntry = entries[ entryName ];
var stat = fs.statSync( cacheEntry.key );
var meta = assign( cacheEntry.meta, {
size: stat.size,
mtime: stat.mtime.getTime()
} );
try {
var stat = fs.statSync( cacheEntry.key );
var meta = assign( cacheEntry.meta, {
size: stat.size,
mtime: stat.mtime.getTime()
} );
cache.setKey( entryName, meta );
cache.setKey( entryName, meta );
} catch (err) {
// if the file does not exists we don't save it
// other errors are just thrown
if ( err.code !== 'ENOENT' ) {
throw err;
}
}
} );
cache.save( noPrune );
cache.save( true );
}

@@ -193,0 +217,0 @@ };

# file-entry-cache - Changelog
## v2.0.0
- **Features**
- do not persist and prune removed files from cache. Relates to [#2](https://github.com/royriojas/file-entry-cache/issues/2) - [408374d]( https://github.com/royriojas/file-entry-cache/commit/408374d ), [Roy Riojas](https://github.com/Roy Riojas), 16/08/2016 15:47:58
## v1.3.1

@@ -4,0 +9,0 @@ - **Build Scripts Changes**

{
"name": "file-entry-cache",
"version": "1.3.1",
"version": "2.0.0",
"description": "Super simple cache for file metadata, useful for process that work o a given series of files and that only need to repeat the job on the changed ones since the previous run of the process",

@@ -32,3 +32,3 @@ "repository": "royriojas/file-entry-cache",

"bump-patch": "npm run pre-v && npm version patch -m 'BLD: Release v%s' && npm run post-v",
"test": "npm run verify && mocha -R spec test/specs",
"test": "npm run verify --silent && mocha -R spec test/specs",
"cover": "istanbul cover test/runner.js html text-summary",

@@ -35,0 +35,0 @@ "watch": "watch-run -i -p 'test/specs/**/*.js' istanbul cover test/runner.js html text-summary"

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