Home

Awesome

upx

NPM Version Dependency Status JavaScript Style Guide

Node cross-platform wrapper for UPX

Install

$ npm install --save upx

Usage

const UPX = require('upx')(opts) // see options below

UPX('Hello.exe')
.output('Compressed.exe')
.start().then(function(stats){
  /* stats:
  { cmd: 'compress',
    name: 'Compressed.exe',
    fileSize: { before: '1859072', after: '408064' },
    ratio: '21.95%',
    format: 'win32/pe',
    affected: 1 }
  */
}).catch(function (err) {
  // ...
})

Methods

upx(<path>) : path is the absolute path to the file to compress/decompress.

.output(<output>) : path to the output file.

.start() : Start the compress/decompress process.

Options

The options below can be true or false.

OptionDescription
fastercompress faster
bettercompress better
bestcompress best (can be slow for big files)
decompressdecompress
listlist compressed files
forceforce compression of suspicious files
brutetry all available compression methods & filters (slow)
ultraBrutetry even more compression variants (very slow)
overlayCopycopy any extra data attached to the file (default)
overlayStripstrip any extra data attached to the file (dangerous)
overlaySkipdon't compress a file with an overlay
8086make compressed sys work on any 8086 (for dos)
noRelocput no relocations in to the exe header (for dos)
8bituses 8 bit size compression (default: 32 bit)
8mibRam8 megabyte memory limit (default 2MiB)

Debug

set the env DEBUG: DEBUG=upx node myScript.js

Author

Rocco Musolino (@roccomuso)

License

MIT