npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

deferred-random-access

1.0.0

@mafintosh

npmHomeRepoSnykSocket
Downloads:1
$ npm install deferred-random-access
DailyWeeklyMonthlyYearly

deferred-random-access

A random-access instance that wraps another instance that is created async.

npm install deferred-random-access

Usage

var dra = require('deferred-random-access')
var ram = require('random-access-memory')

var storage = dra(function (cb) {
  process.nextTick(function () {
    console.log('creating instance')
    cb(null, ram())
  })
})

storage.write(0, Buffer.from('hi'), function () {
  console.log('totally wrote it', storage.length)
  storage.read(0, 2, console.log)
})

License

MIT