https://github.com/jhermsmeier/node-fat32
FAT12/16/32 file system driver
https://github.com/jhermsmeier/node-fat32
disk driver fat fat12 fat16 fat32 filesystem fs
Last synced: 4 months ago
JSON representation
FAT12/16/32 file system driver
- Host: GitHub
- URL: https://github.com/jhermsmeier/node-fat32
- Owner: jhermsmeier
- License: mit
- Created: 2014-12-23T19:34:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-08-06T19:57:39.000Z (almost 6 years ago)
- Last Synced: 2025-01-06T09:26:25.218Z (5 months ago)
- Topics: disk, driver, fat, fat12, fat16, fat32, filesystem, fs
- Language: JavaScript
- Homepage:
- Size: 123 KB
- Stars: 11
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# FAT32 File System
[](https://npmjs.com/package/fat32)
[](https://npmjs.com/package/fat32)
[](https://npmjs.com/package/fat32)
[](https://travis-ci.org/jhermsmeier/node-fat32)FAT12/16/32 file system driver
## Install via [npm](https://npmjs.com)
```sh
$ npm install --save fat32
```## Features
- [x] Reading volume boot & information sector
- [ ] Reading of clusters and cluster chains
- [ ] Write support
- [ ] Node `fs` compatible API
- [ ] Defragmentation
- [ ] Transactions (if multiple FATs are present)## Usage
### Related Modules
- [ExFAT](https://github.com/jhermsmeier/node-exfat) - ExFAT file system driver
- [NTFS](https://github.com/jhermsmeier/node-ntfs) - NTFS file system driver
- [HFS+](https://github.com/jhermsmeier/node-hfsx) - HFS+ file system driver
- [Ext4](https://github.com/jhermsmeier/node-ext4) - Ext4, Ext3, Ext2 file system driver
- [MBR](https://github.com/jhermsmeier/node-mbr) - Master Boot Record (MBR)
- [GPT](https://github.com/jhermsmeier/node-gpt) - GUID Partition Table (GPT)
- [BlockDevice](https://github.com/jhermsmeier/node-blockdevice) - Reads from & writes to block devices, or treats files as block devices
- [Disk](https://github.com/jhermsmeier/node-disk) - Handles a formatted block device (reads the MBR and GPT, creates bounded partitions with BlockDevice APIs)### Mounting a partition from a block device
```js
var BlockDevice = require( 'blockdevice' )
var Disk = require( 'disk' )
var FAT = require( 'fat32' )var device = new BlockDevice({
path: '/dev/rdisk2', // or i.e. '\\\\.\\PhysicalDrive2' on Windows
})var disk = new Disk( device )
var volume = new FAT.Volume()disk.open(( error ) => {
// For purposes of demonstration, error handling will
// not be tended to in this example, but should of course
// be implemented in real-world use cases
if( error ) return handleError( error )// Find a FAT formatted partition
var partNo = disk.mbr.partitions.findIndex(( partition ) => {
return partition.type === 0x0B || partition.type === 0x0C
})// Mount the partition (with a BlockDevice API)
volume.mount( disk.partitions[ partNo ], null, ( error ) => {
console.log( util.inspect( volume ) )
// ...
volume.unmount(( error ) => {
disk.close(( error ) => {
// ...
})
})
})})
``````js
Volume {
device: Partition {
device: BlockDevice {
fd: 13,
path: '/dev/rdisk2',
mode: 'r',
blockSize: 512,
size: -1,
headsPerTrack: -1,
sectorsPerTrack: -1
},
firstLBA: 8192,
lastLBA: 137216
},
bits: 32,
readOnly: true,
vbr: VBR {
jmp: ,
oemName: 'mkfs.fat',
sectorSize: 512,
sectorsPerCluster: 1,
reservedSectors: 32,
numberOfFATs: 2,
rootDirEntries: 0,
sectorCount: 129024,
mediaType: 248,
sectorsPerFAT: 993,
sectorsPerTrack: 32,
numberOfHeads: 64,
hiddenSectors: 0,
fsType: 'FAT32 ',
flags: 0,
version: '0.0',
rootClusterSector: 2,
fsInfoSector: 1,
mirrorSector: 6,
reserved: ,
driveNumber: 128,
corrupted: 0,
extendedSignature: 41,
id: 1892531337,
name: 'boot ',
code: ,
signature: 43605,
rootCluster: 2
},
info: FSInfo {
reserved1: ,
freeClusters: 85480,
lastCluster: 41530,
reserved2:
},
tables: [{
id: 268435448,
eoc: 4279238655,
buffer:
}, {
id: 268435448,
eoc: 4279238655,
buffer:
}]
}
```## References
- [Wikipedia / Design of the FAT file system](https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system)