@run-slicer/cfr
TypeScript icon, indicating that this package has built-in type declarations

0.1.2-0.152 • Public • Published

cfr

A JavaScript port of the CFR decompiler.

Example

const fs = require("fs");
const { decompile } = require("./cfr.js"); // get it from the dist/ directory or jsDelivr

const data = fs.readFileSync("./your/package/HelloWorld.class"); // read a class file
console.log(await decompile("your/package/HelloWorld", {
    source: async (name) => {
        /* provide classes for analysis here, including the one you want to decompile */
        
        console.log(name); /* internal name, e.g. java/lang/Object */
        return name === "your/package/HelloWorld" ? data : null /* class not available */;
    },
    options: {
        /* see https://github.com/leibnitz27/cfr/blob/master/src/org/benf/cfr/reader/util/getopt/OptionsImpl.java#L274 */
        "hidelangimports": "false", /* testing option - don't hide java.lang imports */
    },
}));

Or see the browser-based proof-of-concept in the docs directory.

Licensing

The supporting code for this project and the CFR decompiler are licensed under the MIT License (supporting code, CFR).

This project is not affiliated with, maintained or endorsed by the CFR project in any way. Do NOT report issues with this project to the CFR issue tracker.

Package Sidebar

Install

npm i @run-slicer/cfr

Weekly Downloads

3

Version

0.1.2-0.152

License

MIT

Unpacked Size

3.06 MB

Total Files

6

Last publish

Collaborators

  • zlataovce