How to use the lowdb.db function in lowdb

To help you get started, we’ve selected a few lowdb 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 typicode / json-server / src / cli.js View on Github external
function start(port) {
  for (var prop in low.db) {
    console.log('http://localhost:' + port + '/' + chalk.green(prop))
  }

  console.log(
    '\nEnter ' + chalk.green('`s`') + ' at any time to create a snapshot of the db\n'
  )
  process.stdin.resume()
  process.stdin.setEncoding('utf8')
  process.stdin.on('data', function (chunk) {
    if (chunk.trim().toLowerCase() === 's') {
      var file = 'db-' + Date.now() + '.json'
      low.save(file)
      console.log('\nSaved snapshot to ' + chalk.green(file) + '\n')
    }
  })

lowdb

Tiny local JSON database for Node, Electron and the browser

MIT
Latest version published 11 months ago

Package Health Score

77 / 100
Full package analysis