Git Product home page Git Product logo

node-blockdevice's Introduction

Block Device

npm npm downloads build status

Install via npm

$ npm install blockdevice

Usage Examples

API

new BlockDevice( options )

  • options: Object
    • fs: require( 'fs' ), optional; custom 'fs' instance
    • fd: Number, optional; file descriptor
    • path: String, optional if fd is given
    • mode: String, optional if fd is given
    • blockSize: Number, optional
    • size: Number, optional
    • headsPerTrack: Number, optional
    • sectorsPerTrack: Number, optional

BlockDevice.getPath( id )

  • id: Number

device.open( callback )

  • callback: function( err, fd )

device.close( callback )

  • callback: function( err )

device.detectBlockSize( size, step, limit, callback )

  • size: Number, initial block size to be checked
  • step: Number, block size increment
  • limit: Number, maximum block size to be checked
  • callback: function( err, blockSize )

device.detectSize( step, callback )

  • step: Number, size increment
  • callback: function( err, size )

device.partition( options )

  • options: Object
    • firstLBA: Number, first logical block of partition
    • lastLBA: Number, last logical block of partition

device.getLBA( cylinder, head, sector )

  • cylinder: Number
  • head: Number
  • sector: Number

device._read( offset, length, buffer, callback )

  • offset: Number
  • length: Number
  • buffer: Buffer, optional
  • callback: function( err, buffer, bytesRead )

INTERNAL. Used by .readBlocks().

device.readBlocks( fromLBA, toLBA, buffer, callback )

  • fromLBA: Number
  • fromLBA: Number
  • buffer: Buffer, optional
  • callback: function( err, buffer, bytesRead )

device._write( offset, buffer, callback )

  • offset: Number
  • buffer: Buffer
  • callback: function( err, bytesWritten )

INTERNAL. Used by .writeBlocks().

device.writeBlocks( fromLBA, buffer, callback )

  • fromLBA: Number
  • buffer: Buffer
  • callback: function( err, bytesWritten )

new BlockDevice.Partition( device, options )

  • options: Object
    • firstLBA: Number, first logical block of partition
    • lastLBA: Number, last logical block of partition

get partition.blockSize -> Number

get partition.sectors -> Number, number of blocks in partition

get partition.size -> Number, size in bytes

partition.__OOB( lba )

  • lba: Number, logical block address

INTERNAL. Determines if a given LBA is out of bounds of the partition.

partition.readBlocks( from, to, buffer, callback )

  • from: Number
  • to: Number
  • buffer: Buffer
  • callback: function( err, buffer, bytesRead )

partition.writeBlocks( from, data, callback )

  • from: Number
  • data: Buffer
  • callback: function( err, bytesWritten )

node-blockdevice's People

Contributors

jhermsmeier avatar

Stargazers

Michael Anthony avatar

Watchers

Michael Anthony avatar  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.