sfdisk-parser

0.9.1 • Public • Published

Build Status Coverage Status Version License Code style

Motivation

This package provide a simple parser/serializer of sfdisk dumps.

API

{metas, parts, toString} new SfdiskParser(sfdisk_dump_body);

parts[2][name]= "System reserved somthing";

Example usage

I was in need of the following API

const SfdiskParser = require('sfdisk-parser');
const somesfdiskdump_path = 'mysda.sf';

let sfstruct = new SfdiskParser(fs.readFileSync(somesfdiskdump_path, 'utf-8'));


let reserved = parsed.parts.pop(); //shift last part out of 4

parsed.parts.splice(2, 0, reserved); //put it back as 3rd

delete parsed.metas['last-lba']; //allow write on shorter disk

fs.writeFileSync(somesfdiskdump_path + "_reordered", sfstruct.toString());

Credits

Readme

Keywords

Package Sidebar

Install

npm i sfdisk-parser

Weekly Downloads

0

Version

0.9.1

License

MIT

Unpacked Size

7.52 kB

Total Files

6

Last publish

Collaborators

  • 131