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

mbr

v1.1.3

Published

Master Boot Record (MBR)

Downloads

30,566

Readme

Master Boot Record (MBR)

npm npm license npm downloads build status

Install via npm

$ npm install --save mbr

Used by

Related Modules

  • gpt – Parse, construct & verify GUID Partition Tables
  • apple-partition-map – Parse / construct Apple Partition Maps
  • blockdevice – Read from / write to block devices
  • disk – Disk / image toolbox

Handling Extended / Logical Partitions

Logical partitions are not entries in the MBR. They're constructed from the contents of an extended partition's Extended Boot Records (EBR), which are essentially the same in structure as an MBR and can be parsed with this module as well.

In order to read logical partitions, find a partition entry that's marked as extended partition container, then read that partition's first 512 bytes (the EBR), parse that, then look for additional EBRs in the extended partition. For more detail on how extended / logical partitions work, see Wikipedia / Extended Boot Record

Usage

For a complete API reference, see doc/README.md

var MBR = require( 'mbr' )
// Obtain a Buffer of an MBR
var buffer = fs.readFileSync( 'mbr.bin' )

mbr.bin

Offset   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

000000   FA B8 00 10 8E D0 BC 00 B0 B8 00 00 8E D8 8E C0   ú¸...м.°¸...Ø.À
000010   FB BE 00 7C BF 00 06 B9 00 02 F3 A4 EA 21 06 00   û¾.|¿..¹..ó¤ê!..
000020   00 BE BE 07 38 04 75 0B 83 C6 10 81 FE FE 07 75   .¾¾.8.u..Æ..þþ.u
000030   F3 EB 16 B4 02 B0 01 BB 00 7C B2 80 8A 74 01 8B   óë.´.°.».|²..t..
000040   4C 02 CD 13 EA 00 7C 00 00 EB FE 00 00 00 00 00   L.Í.ê.|..ëþ.....
000050   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
  --
0001A0   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
0001B0   00 00 00 00 00 00 00 00 B9 77 74 8B 00 00 80 00   ........¹wt.....
0001C0   01 40 0C 03 60 7F 00 20 00 00 00 A0 00 00 00 00   .@..`.. ... ....
0001D0   41 80 83 03 E0 FF 00 C0 00 00 00 80 05 00 00 03   A...àÿ.À........
0001E0   E0 FF 83 03 E0 FF 00 40 06 00 00 80 05 00 00 03   àÿ..àÿ.@........
0001F0   E0 FF 0F 03 E0 FF 00 C0 0B 00 00 60 20 00 55 AA   àÿ..àÿ.À...` .Uª
> console.log( new MBR( buffer ) )
{
  physicalDrive: 0,
  timestamp: { seconds: 0, minutes: 0, hours: 0 },
  signature: 2339665849,
  copyProtected: false,
  partitions: [{
    status: 128,
    type: 12,
    sectors: 40960,
    firstLBA: 8192,
    firstCHS: <CHS { cylinder: 0, head: 0, sector: 0 }>,
    lastCHS: <CHS { cylinder: 0, head: 0, sector: 0 }>
  }, {
    status: 0,
    type: 131,
    sectors: 360448,
    firstLBA: 49152,
    firstCHS: <CHS { cylinder: 0, head: 0, sector: 0 }>,
    lastCHS: <CHS { cylinder: 0, head: 0, sector: 0 }>
  }, {
    status: 0,
    type: 131,
    sectors: 360448,
    firstLBA: 409600,
    firstCHS: <CHS { cylinder: 0, head: 0, sector: 0 }>,
    lastCHS: <CHS { cylinder: 0, head: 0, sector: 0 }>
  }, {
    status: 0,
    type: 15,
    sectors: 2121728,
    firstLBA: 770048,
    firstCHS: <CHS { cylinder: 0, head: 0, sector: 0 }>,
    lastCHS: <CHS { cylinder: 0, head: 0, sector: 0 }>
  }],
  code: [{
    offset: 0,
    data: <Buffer fa b8 00 10 8e d0 bc 00 b0 b8...>
  }, {
    offset: 224,
    data: <Buffer 00 00 00 00 00 00 00 00 00 00...>
  }]
}