Git Product home page Git Product logo

node-vhd's Introduction

VHD - Virtual Hard Disk

npm npm downloads build status

From Wikipedia's VHD article

VHD (Virtual Hard Disk) is a file format which represents a virtual hard disk drive (HDD). It may contain what is found on a physical HDD, such as disk partitions and a file system, which in turn can contain files and folders. It is typically used as the hard disk of a virtual machine. The format was created by Connectix for Connectix Virtual PC product, which was later acquired by Microsoft in 2003, for what is now known as Microsoft Virtual PC. Since June 2005, Microsoft has made the VHD Image Format Specification available to third parties under the Microsoft Open Specification Promise.

Install via npm

$ npm install vhd

Types

  • Fixed — The VHD image file is pre-allocated on the backing store for the maximum size requested.
  • Expandable — The VHD image file uses only as much space on the backing store as needed to store the actual data the virtual disk currently contains. Note: The maximum size of a dynamic virtual disk is 2,040 GB.
  • Differencing — A parent virtual disk is used as the basis of this type, with any subsequent writes written to the virtual disk as differences to the new differencing VHD image file, and the parent VHD image file is not modified. Note: The maximum size of a dynamic virtual disk is 2,040 GB.

For more information, see MSDN

Limitations

All virtual disk types have a minimum size of 3 MB.

The VHD format has a built-in limitation of just under 2 TiB (2040 GiB) for the size of any dynamic or differencing VHDs. This is due to a sector offset table that only allows for the maximum of a 32-bit quantity - Which fits our JavaScript environment perfectly, since we can't work with 64 bit integers natively.

Usage

var VHD = require( 'vhd' )

Fixed size VHD

var fixed = new VHD.Fixed( './path/to/image.vhd' )
fixed.open( function( error ) {
  if( error ) {
    // Obviously, something went wrong...
  } else {
    // Ready to read/write to/from image
  }
})
fixed.read( offset, length, function( error, bytesRead, buffer ) {
  // ...
})
fixed.write( buffer, offset, function( error, bytesWritten, buffer ) {
  // ...
})
fixed.close( function( error ) {
  // ...
})

node-vhd's People

Contributors

jhermsmeier 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.