@file-cache/core
A cache for file metadata or file content.
Installation
npm install @file-cache/core
Usage
import { createCache } from '@file-cache/core';
const cache = await createCache({
key: "test",
mode: "metadata"
});
const filePath = path.resolve(__dirname, "./fixtures/f1.txt");
const result = await cache.getAndUpdateCache(filePath);
assert.deepStrictEqual(result, {
changed: true,
error: undefined
});
await cache.reconcile();
const result2 = await cache.getAndUpdateCache(filePath);
assert.deepStrictEqual(result2, {
changed: false,
error: undefined
});
Options
export type CreateCacheOptions = {
mode: "content" | "metadata";
key: string;
cacheDirectory?: string;
};
Tests
npm test
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
MIT