npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

libclassfile

v2.1.0

Published

Parse class files with ease

Readme

libclassfile

Parse class files with ease. Nearly completely up to the specs at https://docs.oracle.com/javase/specs/jvms/se22/html/jvms-4.html and strongly typed. Docs

Use

First, install @chickenjdk/byteutils

Example use:

In this example, there is a file called main.class in the dir, with this source code

public class main
{
    public static void main(String[] args)
    {
        System.out.println("Hello, world! Test test!");
    }
}

Example use code

const { readClassFile } = require("libclassfile");
const { readFileSync } = require("fs");
const { readableBuffer } = require("@chickenjdk/byteutils");
const testFile = readFileSync("./main.class");
console.log(JSON.stringify(readClassFile(new readableBuffer(testFile))));

Example output:

Parsed class file of source code with this package

{
  "minorVersion": 0,
  "majorVersion": 52,
  "constantPool": {
    "1": {
      "class": {
        "name": { "value": "java/lang/Object", "tag": 1, "index": 4 },
        "tag": 7,
        "index": 2
      },
      "nameAndType": {
        "name": { "value": "<init>", "tag": 1, "index": 5 },
        "descriptor": { "value": "()V", "tag": 1, "index": 6 },
        "tag": 12,
        "index": 3
      },
      "tag": 10,
      "index": 1
    },
    "2": {
      "name": { "value": "java/lang/Object", "tag": 1, "index": 4 },
      "tag": 7,
      "index": 2
    },
    "3": {
      "name": { "value": "<init>", "tag": 1, "index": 5 },
      "descriptor": { "value": "()V", "tag": 1, "index": 6 },
      "tag": 12,
      "index": 3
    },
    "4": { "value": "java/lang/Object", "tag": 1, "index": 4 },
    "5": { "value": "<init>", "tag": 1, "index": 5 },
    "6": { "value": "()V", "tag": 1, "index": 6 },
    "7": {
      "class": {
        "name": { "value": "java/lang/System", "tag": 1, "index": 10 },
        "tag": 7,
        "index": 8
      },
      "nameAndType": {
        "name": { "value": "out", "tag": 1, "index": 11 },
        "descriptor": {
          "value": "Ljava/io/PrintStream;",
          "tag": 1,
          "index": 12
        },
        "tag": 12,
        "index": 9
      },
      "tag": 9,
      "index": 7
    },
    "8": {
      "name": { "value": "java/lang/System", "tag": 1, "index": 10 },
      "tag": 7,
      "index": 8
    },
    "9": {
      "name": { "value": "out", "tag": 1, "index": 11 },
      "descriptor": { "value": "Ljava/io/PrintStream;", "tag": 1, "index": 12 },
      "tag": 12,
      "index": 9
    },
    "10": { "value": "java/lang/System", "tag": 1, "index": 10 },
    "11": { "value": "out", "tag": 1, "index": 11 },
    "12": { "value": "Ljava/io/PrintStream;", "tag": 1, "index": 12 },
    "13": {
      "value": { "value": "Hello, world! Test test!", "tag": 1, "index": 14 },
      "tag": 8,
      "index": 13
    },
    "14": { "value": "Hello, world! Test test!", "tag": 1, "index": 14 },
    "15": {
      "class": {
        "name": { "value": "java/io/PrintStream", "tag": 1, "index": 18 },
        "tag": 7,
        "index": 16
      },
      "nameAndType": {
        "name": { "value": "println", "tag": 1, "index": 19 },
        "descriptor": {
          "value": "(Ljava/lang/String;)V",
          "tag": 1,
          "index": 20
        },
        "tag": 12,
        "index": 17
      },
      "tag": 10,
      "index": 15
    },
    "16": {
      "name": { "value": "java/io/PrintStream", "tag": 1, "index": 18 },
      "tag": 7,
      "index": 16
    },
    "17": {
      "name": { "value": "println", "tag": 1, "index": 19 },
      "descriptor": { "value": "(Ljava/lang/String;)V", "tag": 1, "index": 20 },
      "tag": 12,
      "index": 17
    },
    "18": { "value": "java/io/PrintStream", "tag": 1, "index": 18 },
    "19": { "value": "println", "tag": 1, "index": 19 },
    "20": { "value": "(Ljava/lang/String;)V", "tag": 1, "index": 20 },
    "21": {
      "name": { "value": "main", "tag": 1, "index": 22 },
      "tag": 7,
      "index": 21
    },
    "22": { "value": "main", "tag": 1, "index": 22 },
    "23": { "value": "Code", "tag": 1, "index": 23 },
    "24": { "value": "LineNumberTable", "tag": 1, "index": 24 },
    "25": { "value": "([Ljava/lang/String;)V", "tag": 1, "index": 25 },
    "26": { "value": "SourceFile", "tag": 1, "index": 26 },
    "27": { "value": "main.java", "tag": 1, "index": 27 }
  },
  "accessFlags": {
    "isPublic": true,
    "isFinal": false,
    "isSuper": true,
    "isInterface": false,
    "isAbstract": false,
    "isAnnotation": false,
    "isEnum": false,
    "isModule": false
  },
  "thisClass": {
    "name": { "value": "main", "tag": 1, "index": 22 },
    "tag": 7,
    "index": 21
  },
  "superClass": {
    "name": { "value": "java/lang/Object", "tag": 1, "index": 4 },
    "tag": 7,
    "index": 2
  },
  "interfaces": [],
  "fields": [],
  "methods": [
    {
      "accessFlags": {
        "isPublic": true,
        "isPrivate": false,
        "isProtected": false,
        "isStatic": false,
        "isFinal": false,
        "isSynchronized": false,
        "isBridge": false,
        "isVarargs": false,
        "isNative": false,
        "isAbstract": false,
        "isStrict": false,
        "isSynthetic": false
      },
      "name": { "value": "<init>", "tag": 1, "index": 5 },
      "descriptor": { "value": "()V", "tag": 1, "index": 6 },
      "attributes": [
        {
          "name": "Code",
          "maxStack": 1,
          "maxLocals": 1,
          "code": [
            {
              "pos": 0,
              "opcode": 42,
              "mnemonic": "aload_0",
              "operands": [42],
              "wide": false
            },
            {
              "pos": 1,
              "opcode": 183,
              "mnemonic": "invokespecial",
              "operands": [183, 0, 1],
              "wide": false
            },
            {
              "pos": 4,
              "opcode": 177,
              "mnemonic": "return",
              "operands": [177],
              "wide": false
            }
          ],
          "exceptionTable": [],
          "attributes": [
            {
              "name": "LineNumberTable",
              "lineNumberTable": [{ "startPc": 0, "lineNumber": 1 }]
            }
          ]
        }
      ]
    },
    {
      "accessFlags": {
        "isPublic": true,
        "isPrivate": false,
        "isProtected": false,
        "isStatic": true,
        "isFinal": false,
        "isSynchronized": false,
        "isBridge": false,
        "isVarargs": false,
        "isNative": false,
        "isAbstract": false,
        "isStrict": false,
        "isSynthetic": false
      },
      "name": { "value": "main", "tag": 1, "index": 22 },
      "descriptor": {
        "value": "([Ljava/lang/String;)V",
        "tag": 1,
        "index": 25
      },
      "attributes": [
        {
          "name": "Code",
          "maxStack": 2,
          "maxLocals": 1,
          "code": [
            {
              "pos": 0,
              "opcode": 178,
              "mnemonic": "getstatic",
              "operands": [178, 0, 7],
              "wide": false
            },
            {
              "pos": 3,
              "opcode": 18,
              "mnemonic": "ldc",
              "operands": [18, 13],
              "wide": false
            },
            {
              "pos": 5,
              "opcode": 182,
              "mnemonic": "invokevirtual",
              "operands": [182, 0, 15],
              "wide": false
            },
            {
              "pos": 8,
              "opcode": 177,
              "mnemonic": "return",
              "operands": [177],
              "wide": false
            }
          ],
          "exceptionTable": [],
          "attributes": [
            {
              "name": "LineNumberTable",
              "lineNumberTable": [
                { "startPc": 0, "lineNumber": 5 },
                { "startPc": 8, "lineNumber": 6 }
              ]
            }
          ]
        }
      ]
    }
  ],
  "attributes": [
    {
      "name": "SourceFile",
      "sourcefile": { "value": "main.java", "tag": 1, "index": 27 }
    }
  ]
}