level-dynamodb

0.0.1 • Public • Published

level-dynamodb

A convenience package bundling LevelUP and DyamoDOWN

This is a convenience package that bundles the current release of LevelUP and DynamoDOWN and exposes LevelUP on its export.

Use this package to avoid having to explicitly install DynamoDOWN when you want to use DynamoDOWN with LevelUP.

var level = require('level-dynamodb')

// 1) Create our database, supply location and options.
//    This will create or open the underlying LevelDB store.
var db = level('some-table-name', {
  // level options
  valueEncoding: 'json',
  // required DynamoDB options
  dynamo: {
    region: 'us-east-1',
    secretAccessKey: 'abc',
    accessKeyId: '123',
    // optional desired throughput (first run/create only)
    ProvisionedThroughput: {
      ReadCapacityUnits: 1,
      WriteCapacityUnits: 1
    }
  }
})

// 2) put a key & value
db.put('name', 'Level', function (err) {
  if (err) return console.log('Ooops!', err) // some kind of I/O error

  // 3) fetch by key
  db.get('name', function (err, value) {
    if (err) return console.log('Ooops!', err) // likely the key was not found

    // ta da!
    console.log('name=' + value)
  })
})

See LevelUP and DyamoDOWN for more details.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i level-dynamodb

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • dguttman