nuǝW pǝuoᴉʇᴉsoԀ ʎlǝʌᴉʇɐƃǝN

    @zero-version/key-value-storage.file
    TypeScript icon, indicating that this package has built-in type declarations

    9.9.14 • Public • Published

    File key/value storage.

    Usage

    The fileKeyValueStore method accepts two arguments:

    • fileName, which defaults to 'cache.json'
    • dir, which defaults to os.tmpdir()

    The file is persisted each time a set or remove method is invoked, and read each time the get method is invoked.

    import { fileKeyValueStore } from '@zero-version/key-value-storage.file';
    
    const store = fileKeyValueStore();
    
    store.set('my-value', { some: 'value' });
    console.log(store.get('my-value'));
    // -> { some: 'value' }
    
    store.set('my-value', { some: 'other-value' });
    console.log(store.get('my-value'));
    // -> { some: 'other-value' }
    
    store.remove('my-value');
    console.log(store.get('my-value'));
    // -> undefined

    Support

    Are you using a package I've developed and finding it useful? Or have you looked at one of my repositories and learnt something new? If so, please consider buying me a coffee. Thanks!

    Install

    npm i @zero-version/key-value-storage.file

    DownloadsWeekly Downloads

    2

    Version

    9.9.14

    License

    UNLICENSED

    Unpacked Size

    3.39 kB

    Total Files

    5

    Last publish

    Collaborators

    • andrewcrobertson