npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

chs

v1.1.0

Published

Cylinder-Head-Sector Address (CHS)

Downloads

18,090

Readme

CHS (Cylinder-Head-Sector) Address

npm npm license npm downloads build status

CHS addressing is an early method for giving addresses to each physical block of data on a hard disk drive, identifying individual sectors on a disk by their position in a track, where the track is determined by the head and cylinder numbers.

Install via npm

$ npm install --save 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
var buf = addr.toBuffer()
// Set from buffer
addr.buffer = new Buffer([ 0xFE, 0xFF, 0xFF ])
addr.parse( new Buffer([ 0xFE, 0xFF, 0xFF ]) )

API Reference

CHS

Kind: global class


new CHS([cylinder], [head], [sector])

Cylinder-Head-Sector Address

Params

  • [cylinder] Number | Buffer = 1023
  • [head] Number = 254
  • [sector] Number = 63

chS.cylinder : Number

Cylinder

Kind: instance property of CHS


chS.head : Number

Head

Kind: instance property of CHS


chS.sector : Number

Sector

Kind: instance property of CHS


chS.buffer : Buffer

Get/set values from/to a Buffer

Kind: instance property of CHS


chS.setLBA(lba, hpt, spt) ⇒ CHS

Set CHS to a Logical Block Address (LBA)

Kind: instance method of CHS
Params

  • lba Number - Logical Block Address
  • hpt Number - Heads per Track
  • spt Number - Sectors per Track

chS.getLBA(hpt, spt) ⇒ Number

Get the Logical Block Address (LBA) corresponding to the given disk geometry

Kind: instance method of CHS
Returns: Number - lba
Params

  • hpt Number - Heads per Track
  • spt Number - Sectors per Track

chS.toLBA(hpt, spt) ⇒ Number

Kind: instance method of CHS
Returns: Number - lba
See: #getLBA()
Params

  • hpt Number - Heads per Track
  • spt Number - Sectors per Track

chS.clone() ⇒ CHS

Clone the CHS Address

Kind: instance method of CHS


chS.copy(target) ⇒ CHS

Copy this address to a target address

Kind: instance method of CHS
Params


chS.parse(buffer, [offset]) ⇒ CHS

Parse a given Buffer

Kind: instance method of CHS
Params

  • buffer Buffer
  • [offset] Number = 0

chS.write(buffer, [offset]) ⇒ Buffer

Write the CHS address to a given buffer

Kind: instance method of CHS
Params

  • buffer Buffer
  • [offset] Number = 0

chS.toBuffer() ⇒ Buffer

Create a Buffer representation of the CHS Address

Kind: instance method of CHS


chS.fromNumber(value) ⇒ CHS

Set the CHS address from its 24bit integer value

Kind: instance method of CHS
Params

  • value Number

chS.toNumber() ⇒ Number

Get the 24bit integer value of the CHS address

Kind: instance method of CHS


CHS.fromBuffer(buffer, [offset]) ⇒ CHS

Create a CHS Address from a given buffer

Kind: static method of CHS
Params

  • buffer Buffer
  • [offset] Number = 0

CHS.fromLBA(lba, hpt, spt) ⇒ CHS

Create a CHS Address from a Logical Block Address (LBA)

Kind: static method of CHS
Params

  • lba Number - Logical Block Address
  • hpt Number - Heads per Track
  • spt Number - Sectors per Track