with-fs-cache
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

with-fs-cache

Wrap any method, sync or async with a File System Cache.

Usage

const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
 
const myID = await withFsCache(
  // Can be anything
  "my-id",
  async () => {
    await sleep(500);
    functionCallCount += 1;
    return { someData: "1" };
  }
);
 
// If called again it will return without waiting.

/with-fs-cache/

    Package Sidebar

    Install

    npm i with-fs-cache

    Weekly Downloads

    6

    Version

    0.3.1

    License

    GPL-3.0-only

    Unpacked Size

    13.2 kB

    Total Files

    11

    Last publish

    Collaborators

    • rakannimer