Registry / devops / java-asm

java-asm

JSON →
library0.0.6jsnpmunverified

A TypeScript migration of the Java ASM bytecode manipulation framework, targeting v0.0.6 as the latest release (no regular cadence). This library reads Java class files and exposes parsed structures like annotations, methods, and fields. It is unstable and incomplete: only read operations are supported, write functions are explicitly broken. Compared to the original Java ASM, this port is limited and experimental, maintained by a single developer with no guarantees. Best suited for small-scale annotation reading tasks.

npm install java-asm
INSTALL
IMPORT
SIG · JAVA-ASM
J
java-asm
devopsjavascriptv0.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ClassReader
import { ClassReader } from 'java-asm'
const ClassReader = require('java-asm')
ESM-only; no CommonJS support.
ClassVisitor
import { ClassVisitor } from 'java-asm'
const ClassVisitor = require('java-asm').ClassVisitor
ESM-only; requires named import.
Opcodes
import { Opcodes } from 'java-asm'
import * as asm from 'java-asm'; const Opcodes = asm.Opcodes;
Direct named import is correct; the wrong pattern is unnecessarily verbose but works.

Reads a Java class file (as ArrayBuffer) and prints class name, super class, and method signatures.

import { ClassReader } from 'java-asm'; const classBytes = new ArrayBuffer(8); // placeholder const reader = new ClassReader(classBytes); const classFile = reader.read(); console.log(classFile.className, classFile.superClass); for (const method of classFile.methods) { console.log('Method:', method.name, method.desc); }
Debug
Known issues
deprecatedWrite functions are broken and unmaintained.
fix
Use a different library like javy-jvm for writing class files.
affects: >=0.0.0
gotchaOnly works with Java class files (not JAR, not live JVM).
fix
Ensure input is .class file bytes; for JAR, extract entries first.
affects: >=0.0.0
gotchaThe library is unstable and may produce incorrect results for complex class files.
fix
Test thoroughly with your class files; prefer production-ready solutions.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: ClassReader is not a constructor
Using CommonJS require instead of ESM import.
fix
Use import { ClassReader } from 'java-asm' in an ESM context.
Cannot find module 'java-asm'
Package is not installed or not in node_modules.
fix
Run npm install java-asm --save (but note it's deprecated).
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
java-asm — npm install java-asm · libregistry