GithubHelp home page GithubHelp logo

strong-roots-capital / node-ramdisk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joaquimserafim/node-ramdisk

0.0 1.0 0.0 132 KB

create a ram disk with node.js

License: ISC License

JavaScript 73.24% Shell 26.76%

node-ramdisk's Introduction

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

node-ramdisk's People

Contributors

joaquimserafim avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.