file-entry-cache
Advanced tools
Comparing version 5.0.0 to 5.0.1
25
cache.js
@@ -232,2 +232,19 @@ var path = require( 'path' ); | ||
}, | ||
_getMetaForFileUsingCheckSum: function ( cacheEntry ) { | ||
var contentBuffer = fs.readFileSync( cacheEntry.key ); | ||
var hash = this.getHash( contentBuffer ); | ||
var meta = Object.assign( cacheEntry.meta, { hash: hash } ); | ||
return meta; | ||
}, | ||
_getMetaForFileUsingMtimeAndSize: function ( cacheEntry ) { | ||
var stat = fs.statSync( cacheEntry.key ); | ||
var meta = Object.assign( cacheEntry.meta, { | ||
size: stat.size, | ||
mtime: stat.mtime.getTime() | ||
} ); | ||
return meta; | ||
}, | ||
/** | ||
@@ -244,3 +261,2 @@ * Sync the files and persist them to the cache | ||
var keys = Object.keys( entries ); | ||
var me = this; | ||
@@ -251,2 +267,4 @@ if ( keys.length === 0 ) { | ||
var me = this; | ||
keys.forEach( function ( entryName ) { | ||
@@ -256,6 +274,3 @@ var cacheEntry = entries[ entryName ]; | ||
try { | ||
var contentBuffer = fs.readFileSync( cacheEntry.key ); | ||
var hash = me.getHash( contentBuffer ); | ||
var meta = Object.assign( cacheEntry.meta, { hash: hash } ); | ||
var meta = useChecksum ? me._getMetaForFileUsingCheckSum( cacheEntry ) : me._getMetaForFileUsingMtimeAndSize( cacheEntry ); | ||
cache.setKey( entryName, meta ); | ||
@@ -262,0 +277,0 @@ } catch (err) { |
# file-entry-cache - Changelog | ||
## v5.0.1 | ||
- **Bug Fixes** | ||
- Fix missing checksum comparison from reconcile since now we use mtime and size by default. - [e858aa9]( https://github.com/royriojas/file-entry-cache/commit/e858aa9 ), [Roy Riojas](https://github.com/Roy Riojas), 04/02/2019 12:30:22 | ||
Old mode using checkSum can still be used by passing the `useCheckSum` parameter to the `create` or `createFromFile` methods. | ||
## v5.0.0 | ||
@@ -4,0 +10,0 @@ - **Refactoring** |
{ | ||
"name": "file-entry-cache", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"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", | ||
@@ -5,0 +5,0 @@ "repository": "royriojas/file-entry-cache", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24519
242