How to use the dirty.on function in dirty

To help you get started, we’ve selected a few dirty 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 felixge / node-dirty / benchmark / dirty / load.js View on Github external
dirty.on('drain', function() {
  var start = Date.now();
  require('dirty')(DB_FILE).on('load', function(length) {
    var ms = Date.now() - start,
        mhz = ((COUNT / (ms / 1000)) / 1e3).toFixed(2),
        million = COUNT / 1e6;

    // Can't use console.log() since since I also test this in ancient node versions
    util.log(mhz+' Hz ('+million+' million in '+ms+' ms)');

    loaded = true;

    assert.equal(length, COUNT);
  });
});

dirty

A tiny & fast key value store with append-only disk log. Ideal for apps with < 1 million records.

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Popular dirty functions