pe-library

Node.js library for Portable Executable format

Usage no npm install needed!

<script type="module">
  import peLibrary from 'https://cdn.skypack.dev/pe-library';
</script>

README

NPM version Build Status

pe-library

pe-library provides parsing and generating Portable Executable (known as Windows Executables) binaries.

Usage

const PE = require('pe-library');
const fs = require('fs');

// load and parse data
let data = fs.readFileSync('MyApp.exe');
// (the Node.js Buffer instance can be specified directly to NtExecutable.from)
let exe = PE.NtExecutable.from(data);

// get section data
let exportSection = exe.getSectionByEntry(PE.Format.ImageDirectoryEntry.Export);
// read binary data stored in exportSection.data ...
// to write binary: use exe.setSectionByEntry

// write to buffer
let newBin = exe.generate();
fs.writeFileSync('MyApp_modified.exe', new Buffer(newBin));

License