This package provide a simple parser/serializer of sfdisk dumps.
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());