Novelty Plastic Moustache

    random-access-memory

    4.1.0 • Public • Published

    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
    

    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

    Keywords

    none

    Install

    npm i random-access-memory

    DownloadsWeekly Downloads

    904

    Version

    4.1.0

    License

    MIT

    Unpacked Size

    9.71 kB

    Total Files

    7

    Last publish

    Collaborators

    • mafintosh