chs

Cylinder-Head-Sector Address (CHS)

npm install chs
2 downloads in the last month

CHS - Cylinder Head Sector Address

build status NPM version

Install via npm

$ npm install chs

Usage

// Load module
var CHS = require( 'chs' )
// Create a CHS address
var addr = new CHS( 5, 20, 8 )
// Properties:
var c = addr.cylinder
var h = addr.head
var s = addr.sector
// Convert to an LBA (Logical Block Address)
var lba = addr.toLBA( headsPerTrack, sectorsPerTrack )
var lba = addr.toLBA( 12, 32 )
// Set it to an LBA
addr.setLBA( lba, headsPerTrack, sectorsPerTrack )
addr.setLBA( 3150, 16, 63 )
// Get it as a buffer
var buf = addr.buffer
// Set from buffer
addr.buffer = new Buffer([ 0xFE, 0xFF, 0xFF ])
npm loves you