How to use keyv - 2 common examples

To help you get started, we’ve selected a few keyv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github collective-soundworks / soundworks / src / server / Db.js View on Github external
constructor(options = {}) {
    const dbDirectory = path.join(process.cwd(), '.db');

    if (!fs.existsSync(dbDirectory)) {
      fs.mkdirSync(dbDirectory);
    }

    const filename = path.join(dbDirectory, 'keyv.db')

    this.keyv = new Keyv({
      namespace: 'soundworks',
      store: new KeyvFile({ filename }),
    });

    this.keyv.on('error', err => console.log('Connection Error', err));
  }

keyv

Simple key-value storage with support for multiple backends

MIT
Latest version published 7 months ago

Package Health Score

95 / 100
Full package analysis

Popular keyv functions