Not a Package Manager

    file-conf-cache

    1.0.2 • Public • Published

    File Conf Cache

    Build status

    A simple node js module that allows treating a local file as a configuration database.

    This is done by making sure that every property read will efficiently check if the file is updated, if it is, the repository will be updated.

    Usage:

    var fileConfCache = require('file-conf-cache');
     
    // Init configuration:
    const conf = fileConfCache('configuration.json')
    //
    Define a reader method:
     
    function readerMethod(_, key){
        return _[key];
    }
     
    //read data
    conf.getValue(readerMethod, 'somevalue')
     
    Reader method

    Reader method is left for the client to implment to allow functionalities such as default value:

    function readerMethod (_, key, defaultValue){
      return _[key] || defaultValue;
    }
     
    conf.getValue(readerMethod, 'non-existing', 'marak') == 'marak'
     

    Or various other more complicated logic

    Keywords

    none

    Install

    npm i file-conf-cache

    DownloadsWeekly Downloads

    2

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    141 kB

    Total Files

    8

    Last publish

    Collaborators

    • avnerner