New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ramdisk

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ramdisk

RAM disk which behaves like a BlockDevice

latest
Source
npmnpm
Version
0.3.1
Version published
Weekly downloads
5
-37.5%
Maintainers
1
Weekly downloads
 
Created
Source

RAM Disk

npm npm downloads build status

Install via npm

$ npm install ramdisk

What? Why? How does it work?!

This is just the easiest & quickest cross-platform solution that I just happened to come up with at the time. I mainly need it to test file system implementations and the like. The API is pretty much the same as blockdevice's, which features some crappy documentation on it. It's most likely worse than just reading the code. I'll work on it, I promise.

Thing is, it allocates sparsely (with the worst possible allocator (if you can even call it that) ever written to date) - meaning - you can specify 4 GB as size & you won't occupy 4 GB of memory, until you actually write to every sector.

Usage

var RamDisk = require( 'ramdisk' )
// Options, with their defaults
var device = new RamDisk({
  // Emulated (?) device block size
  blockSize: 512,
  // Cluster size. It allocates in these.
  clusterSize: 4096,
  // The grand total (absolutely imaginary) size
  // of the entire contraption!
  size: 10 * 1024 * 1024,
})
// Supplying a buffer to .readBlocks() is optional
var buffer = new Buffer( device.blockSize )

device.readBlocks(
  fromLBA, toLBA, buffer,
  function( error, buffer, bytesRead ) {
    // ...
  }
)

Keywords

ram

FAQs

Package last updated on 29 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts