file-entry-cache 11.1.2 → 11.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/index.cjs +535 -543
- package/dist/index.d.cts +257 -271
- package/dist/index.d.mts +290 -0
- package/dist/index.mjs +519 -0
- package/package.json +11 -17
- package/dist/index.d.ts +0 -304
- package/dist/index.js +0 -525
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# file-entry-cache
|
|
4
4
|
> A lightweight cache for file metadata, ideal for processes that work on a specific set of files and only need to reprocess files that have changed since the last run
|
|
5
5
|
|
|
6
|
-
[](https://codecov.io/gh/jaredwray/cacheable)
|
|
6
|
+
[](https://codecov.io/gh/jaredwray/cacheable)
|
|
7
7
|
[](https://github.com/jaredwray/cacheable/actions/workflows/tests.yml)
|
|
8
8
|
[](https://www.npmjs.com/package/file-entry-cache)
|
|
9
9
|
[](https://www.npmjs.com/package/file-entry-cache)
|
|
@@ -61,8 +61,12 @@ let fileDescriptor = cache.getFileDescriptor('./src/file.txt');
|
|
|
61
61
|
console.log(fileDescriptor.changed); // true as it is the first time
|
|
62
62
|
console.log(fileDescriptor.key); // './src/file.txt' (stored as provided)
|
|
63
63
|
|
|
64
|
+
// Repeated calls keep reporting `changed: true` until you persist the state
|
|
65
|
+
// with reconcile(); only then does the file become the cached baseline.
|
|
66
|
+
cache.reconcile();
|
|
67
|
+
|
|
64
68
|
fileDescriptor = cache.getFileDescriptor('./src/file.txt');
|
|
65
|
-
console.log(fileDescriptor.changed); // false as it has not changed
|
|
69
|
+
console.log(fileDescriptor.changed); // false as it has not changed since reconcile()
|
|
66
70
|
|
|
67
71
|
// do something to change the file
|
|
68
72
|
fs.writeFileSync('./src/file.txt', 'new data foo bar');
|