Giter VIP home page Giter VIP logo

resedit-js's Introduction

NPM version Build Status

resedit-js

(Beta) resedit-js is a library that manipulates resouces contained by Windows Executable files. All implementations are written in JavaScript (TypeScript), so there are no further restrictions for running environment.

Install

npm install resedit

Supported formats

  • Windows Executables (PE Format, such as .exe and .dll), both 32-bit and 64-bit, are supported.
    • Executables for 16-bit Windows is not supported.
  • .res file is not supported now.
  • PNG-based icon data is supported on require('resedit').Resource.IconGroupEntry class.

Notes

  • It is not strongly recommended that the destination executable file is equal to the source executable file.
  • Using from command-line is not supported now.

Examples

For more APIs, please see dist directory of the package. And, some test codes may help you for usages.

const ResEdit = require('resedit');
const fs = require('fs');

// load and parse data
let data = fs.readFileSync('MyApp.exe');
let exe = ResEdit.NtExecutable.from(data.buffer);
let res = ResEdit.NtExecutableResource.from(exe);

// rewrite resources
// - You can use helper classes as followings:
//   - ResEdit.Resource.IconGroupEntry: access icon resource data
//   - ResEdit.Resource.StringTable: access string resource data
//   - ResEdit.Resource.VersionInfo: access version info data
let viList = ResEdit.Resource.VersionInfo.fromEntries(res.entries);
let vi = viList[0];
vi.fixedInfo.fileVersionMS = 0x10001; // '1.1'
vi.fixedInfo.fileVersionLS = 0;
// ('lang: 1033' means 'en-US', 'codepage: 1200' is the default codepage)
vi.setStringValues({ lang: 1033, codepage: 1200 }, {
    FileDescription: 'My application',
    FileVersion: '1.1',
    ProductName: 'My product'
});
vi.outputToResourceEntries(res.entries);

// write to another binary
res.outputResource(exe);
let newBinary = exe.generate();
fs.writeFileSync('MyApp_modified.exe', new Buffer(newBinary));

License

MIT License

resedit-js's People

Contributors

jet2jet avatar alexanderomara avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.