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

node-ramdevice

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ramdevice

create a ram disk with node.js

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

node-ramdisk

(This repository is a fork of node-ramdisk). Our CI is on a windows machine, even though the application using this module are not running on windows. In order for us to be able to build it, we are removing the os targets of darwin and linux from the module's package.json.

If you need to use a library. Please refer to the original one at https://github.com/joaquimserafim/node-ramdisk.

create a ram disk with node.js

Build StatusCode Coverage 100%ISC License

API

var ramdisk = require('node-ramdisk')

return a ramdisk object

ramdisk(volumeName)

var disk = ramdisk('my_ramdisk')

ramdisk#create(size[, callback(err, mount)])
  • size - {integer} the size of the volume in MB
  • callback - {function}
    • err - {Error} error message
    • mount - {string} the mounted block, in case of error is undefined
ramdisk#delete(volume[, callback(err, res)])
  • mount - {string} the mounted block
  • callback {function}
    • err - {Error} error message
    • res - {string} return 'ok' in case of success, in case of error is undefined

Note: delete will eject the volume and remove the mount folder

Usage

var ramdisk = require('node-ramdisk')

var disk = ramdisk('my_ramdisk')

var volumePoint

// create a disk with 100MB of size
disk.create(100, function (err, mount) {
  if (err) {
    console.log(err)
  } else {
    volumePoint = mount
    console.log(mount)
  }
})

// when isn't needed then delete the disk
disk.delete(volumePoint, function (err) {
  if (err) {
    console.log(err)
  } else {
    console.log('ok')
  }
})

Debug

DEBUG=node-ramdisk ...

Supported OS

  • darwin (bad performance - is taking around 1 sec. to create the disk in my macbook pro mid 2012)
  • linux (good performance - 20/30 mls to create the disk in a vagrant vm with few resources)

Development

this projet has been set up with a precommit that forces you to follow a code style, no jshint issues and 100% of code coverage before commit

to run test

npm test

to run jshint

npm run jshint

to run code style

npm run code-style

to run check code coverage

npm run check-coverage

to open the code coverage report

npm run open-coverage

Keywords

mount

FAQs

Package last updated on 25 May 2018

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