Skip to content
Exposes the same interface as random-access-file but instead of writing/reading data to a file it maintains it in memory
Branch: master
Clone or download
Latest commit f5e1890 Dec 5, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore first commit Apr 16, 2016
.travis.yml
LICENSE
README.md fix badge Mar 19, 2018
example.js allow del size to be out of bounds Dec 5, 2018
index.js allow del size to be out of bounds Dec 5, 2018
package.json 3.1.1 Dec 5, 2018
test.js use random-access-storage Mar 19, 2018

README.md

random-access-memory

Exposes the same interface as random-access-file but instead of writing/reading data to a file it maintains it in memory. This is useful when running tests where you don't want to write files to disk.

npm install random-access-memory

build status

Usage

var ram = require('random-access-memory')
var file = ram()

file.write(0, Buffer.from('hello'), function () {
  file.write(5, Buffer.from(' world'), function () {
    file.read(0, 11, console.log) // returns Buffer(hello world)
  })
})

You can also initialize a ram instance with a Buffer:

var file = ram(Buffer.from('hello world'))

License

MIT

You can’t perform that action at this time.