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

ezjww

v0.7.13

Published

JWW/JWC reader, JWW writer and DXF converter for TypeScript, powered by Rust WebAssembly.

Readme

ezjww for TypeScript

Read JWW/JWS and supported JWC drawings, create new JWW drawings, and export DXF with a Rust parser compiled to WebAssembly.

This checkout prepares 0.5.0, adding SXF color/line tables, solids, ellipses, dimensions, blocks and convenience APIs to the writer introduced in 0.4.0. Build from source until 0.5.0 is published.

JWS reading is available in this source checkout. See the JWS guide for supported versions, coordinates and image limits.

Installation

Node.js 18 or later:

npm install ezjww

Read and convert a drawing

import { readFileSync, writeFileSync } from "node:fs";
import { detectFileFormat, readCadDocument, readDxfDocument, readDxfString } from "ezjww";

const data = readFileSync("drawing.jwc"); // also accepts JWW and JWS
console.log(detectFileFormat(data));     // "jww", "jwc", "jws", or null

const cad = readCadDocument(data);
if (cad.format === "jwc") {
  console.log(cad.document.header.paper, cad.document.header.source_version);
} else {
  console.log(cad.document.header.version);
}

const options = { jwcCoordinates: "model_millimeters" as const };
const dxf = readDxfDocument(data, options);
console.log(dxf.entities.length, dxf.jwc_conversion_report?.notices);
writeFileSync("drawing.dxf", readDxfString(data, {
  ...options,
  targetVersion: "AC1024",
}));

All readers accept Uint8Array, ArrayBuffer, and ArrayBufferView, respecting view offsets and lengths. Detection uses file contents, not the filename. A matching signature does not validate the complete file.

| Purpose | API | | --- | --- | | Detect either format | detectFileFormat | | Read either source document | readCadDocument | | Read JWW only | isJwwFile, readHeader, readDocument | | Read JWC only | isJwcFile, readJwcHeader, readJwcDocument | | Convert either format | readDxfDocument, readDxfString (toDxfString alias) | | Create a new JWW | newJwwDocument, toJwwBytes |

DxfOptions accepts targetVersion ("AC1015" by default or "AC1024") for string output, explodeInserts (default false), maxBlockNesting (default 32, minimum 1), and jwcCoordinates ("paper_millimeters" by default or "model_millimeters"). The JWC coordinate option does not change JWW conversion.

Create a JWW drawing

Build this revision from source with pnpm install --frozen-lockfile and pnpm run build in packages/ezjww to use the writer API:

import { writeFileSync } from "node:fs";
import { newJwwDocument, toJwwBytes } from "ezjww";

const drawing = newJwwDocument();
drawing.options.memo = "平面図\r\n";
drawing.entities.push({
  type: "LINE",
  base: {
    group: 0, pen_style: 1, pen_color: 1, pen_width: 0,
    layer: 0, layer_group: 0, flag: 0,
  },
  start_x: 0, start_y: 0, end_x: 100, end_y: 0,
});
writeFileSync("created.jww", toJwwBytes(drawing));

The editable JwwWriteDocument has options, entities and block_defs; parsed JwwDocument objects cannot be passed to the writer. Output is version 700, supporting lines, circles/ellipses, arcs, points, text, solids, dimensions and blocks, with editable palette/line/preset tables. toWriteDocument() explicitly converts a parsed document and reports unsupported values. Coordinates are paper mm. Native arc fields use radians; text angles use degrees. Each write validates current values and returns an independent Uint8Array without filesystem I/O. Unknown/missing fields, invalid numbers and unsupported features throw errors, including through raw WASM.

See the writer API and limits for all required fields, settings and the browser API. These APIs share the Python/Rust writer input contract and deterministic output.

JWC support

The supported binary document profiles are fixed2421_basic_v1 and fixed2389_basic_v1 (two header layouts, one record layout). They cover lines, circles, circular and elliptical arcs, rotated ellipses, CP932 text, points, and auxiliary points. Some curve sequences are represented as line segments. Settings and attribute bits outside the reference corpus are retained and reported as JWC_* diagnostics. Other JWC layouts are not covered by a general compatibility guarantee.

The source document retains original coordinates, names, attributes, and byte spans. header.source_version is currently null. DXF defaults to paper millimeters centered on the sheet with +Y up; model_millimeters applies each entity's own layer-group scale once.

DXF output preserves millimeter units and TEXT width factors. Rendering defaults for the palette, dashes, and font, along with text-spacing limits, are reported in jwc_conversion_report.notices. Unknown layouts or attributes, partial ellipses, and inconsistent string pools throw errors with byte offsets. Malformed JWC does not return a partial document; CP932 replacement decoding produces diagnostics.

See the API reference, JWC support and limits, and diagnostic codes. Repository documentation describes the source version; use documentation at your installed package's release tag when working with an older release.

Browser example

The npm entry point targets Node.js. The repository includes a browser example that builds the Rust WASM module for the web and parses selected files locally. For the browser build, use Node.js 22.12+ (or 20.19+ on the 20.x line), Rust, and pnpm. From a checkout:

cd packages/ezjww
pnpm install
pnpm run example:browser:dev

The app displays layers, source JSON, diagnostics, and previews, and can download converted DXF. “JWW作成例” creates a drawing with all five supported entity types; “生成JWW保存” downloads that new drawing. For JWC, it offers paper/model coordinates and conversion notices. Invisible JWC layers are hidden; fonts are substituted. See the browser guide.

License

MIT