@createlumina/asm
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ASM Module

Version made for Lumina projects. Original credits goes to Voxelum/minecraft-launcher-core-node

npm version Downloads Install size npm Build Status

Parse Java bytecode, which port from java asm package.

Usage

Visit java class in jar file

The usage is just like asm library in java:

import { AnnotationVisitor, ClassReader, ClassVisitor, MethodVisitor, Opcodes } from '@createlumina/asm';

class CustomClassVisitor extends ClassVisitor {
    public constructor() {
        super(Opcodes.ASM5);
    }

    // visit the class
    visit(
        version: number,
        access: number,
        name: string,
        signature: string,
        superName: string,
        interfaces: string[],
    ): void {}

    // visit method
    public visitMethod(access: number, name: string, desc: string, signature: string, exceptions: string[]) {
        return null;
    }

    // visit field
    public visitField(access: number, name: string, desc: string, signature: string, value: any) {
        return null;
    }
}

const visitor = new CustomClassVisitor();
const classData: Buffer = await fs.readFile('path/to/some.class');
new ClassReader(classData).accept(visitor);

Readme

Keywords

Package Sidebar

Install

npm i @createlumina/asm

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

2.36 MB

Total Files

57

Last publish

Collaborators

  • padowyt2