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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@linuxcnc-node/gcode

v2.1.3

Published

Node.js G-code parser using LinuxCNC rs274ngc interpreter

Downloads

333

Readme

@linuxcnc-node/gcode

G-code file parser for Node.js using LinuxCNC's rs274ngc interpreter. Parse G-code files and extract sequential operations for toolpath visualization.

Installation

npm install @linuxcnc-node/gcode

Usage

import { parseGCode } from "@linuxcnc-node/gcode";
import { OperationType, PositionIndex } from "@linuxcnc-node/types";

const result = await parseGCode("/path/to/program.ngc", {
  iniPath: "/path/to/linuxcnc.ini",
  onProgress: (p) => console.log(`${p.percent}% - ${p.operationCount} ops`),
});

console.log(`Parsed ${result.operations.length} ops`, result.extents);

const { X, Y, Z } = PositionIndex;
for (const op of result.operations) {
  if (op.type === OperationType.TRAVERSE) {
    console.log(`Rapid to ${op.pos[X]}, ${op.pos[Y]}, ${op.pos[Z]}`);
  } else if (op.type === OperationType.FEED) {
    console.log(`Feed to ${op.pos[X]}, ${op.pos[Y]} @ F${op.feedRate}`);
  }
}

API

parseGCode(filepath, options)

Returns Promise<GCodeParseResult>.

Options (ParseOptions):

  • iniPath: Path to LinuxCNC INI file (required)
  • onProgress: Callback (progress: ParseProgress) => void
  • progressUpdates: Target number of progress updates (default: 40, set to 0 to disable)

Types

Operation Types

| Type | Description | | -------------- | --------------------- | | TRAVERSE | G0 rapid motion | | FEED | G1 linear feed motion | | ARC | G2/G3 arc motion | | PROBE | G38.x probe motion | | RIGID_TAP | G33.1 rigid tapping | | DWELL | G4 pause | | NURBS_G5/G6 | NURBS curves | | UNITS_CHANGE | G20/G21 | | PLANE_CHANGE | G17/G18/G19 | | TOOL_CHANGE | M6 |

(See types.ts for full list including offsets and rotations)

Requirements

  • Linux
  • LinuxCNC installed (provides rs274ngc interpreter library)
  • Node.js 18+

Building from Source

Requires LinuxCNC development headers. Set LINUXCNC_INCLUDE environment variable if headers are not in standard location.

export LINUXCNC_INCLUDE=/path/to/linuxcnc/include
npm install
npm run build

License

GPL-2.0-only