Disk
npm
Install via$ npm install --save disk
Related Modules
Internals:
- MBR – Master Boot Record
- GPT – GUID Partition Table
- CHS – Cylinder-Head-Sector Addressing
- apple-partition-map – Apple Partition Map
- BlockDevice – Block device handling
- RamDisk – In-memory block device
Block Devices:
- VHD – Microsoft Virtual Hard Disk format
- UDIF – Apple's DMG / UDIF (Universal Disk Image Format)
- UDF – OSTA Universal Disk Format
File Systems:
- FAT32 – FAT32/16/12 file system driver
- ExFAT – ExFAT file system driver
- HFSX – Apple HFS+ file system driver
- NTFS – NTFS file system driver
Usage
var Disk =
Set up a device to work with. This can be anything with a blockdevice compatible API.
var device = path: BlockDevice
Create a disk:
var disk = device
Open the device:
// This also attempts to detect it's block size if unspecified,// as well as reading the MBR & GPT on the devicedisk
Read or write the MBR (disk.mbr
) from or to the device:
diskdisk
Read or write the GPT (disk.gpt
) from or to the device:
diskdisk
Verify the backup GPT; NOTE: The callback will be called with an error and the backup GPT if it doesn't verify.
disk
Close the device:
disk
API
Disk
new Disk( device )
Properties:
- device
- mbr
- gpt
Methods:
- open( callback )
- close( callback )
- getEFIPart()
- readMBR( callback )
- writeMBR( callback )
- readGPT( callback )
- writeGPT( callback )
- writeGPT( callback ): Not implemented