libmount
v0.1.0
Published
Standalone FAT12, FAT16, FAT32, VFAT implementation in JavaScript
Downloads
86
Maintainers
Readme
LibMount
Standalone FAT12, FAT16, FAT32, VFAT implementation in JavaScript
Installation
npm install libmount
API
function mount(img: Uint8Array, charmap?: string): LmDisk;
Example
import { mount } from "libmount";
import { readFileSync } from "fs";
import { cp1251 } from "libmount/codecs/cp1251";
const file = readFileSync("./freedos722.img", { flag: "r" }, cp1251);
const disk = mount(new Uint8Array(file));
const fs = disk.getFileSystem();
if (fs === null) {
console.error("FileSystem is not detected");
process.exit(2);
}
fs.mkfile('/test/bar.txt').getAbsolutePath();
print(fs.getRoot());
console.log(`FileSystem: ${fs.getName()}`);
console.log(`VolumeInfo: ${JSON.stringify(fs.getVolumeInfo())}`);
function print(f) {
console.log(f.getAbsolutePath());
f.listFiles()?.forEach(print);
}
Commands
npm run build
- lint, compile, test and bundle javascript source files to dist/libmount.min.mjs
npm run dev
- start local http server