@zebrash/node 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +69 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @zebrash/node
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@zebrash/node?color=cb3837&logo=npm)](https://www.npmjs.com/package/@zebrash/node)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Render [ZPL II](https://en.wikipedia.org/wiki/Zebra_Programming_Language) labels
7
+ to PNG or SVG on Node.js and Bun. Pure-TypeScript port of
8
+ [ingridhq/zebrash](https://github.com/ingridhq/zebrash). Rasterizes via
9
+ [`@napi-rs/canvas`](https://github.com/Brooooooklyn/canvas) (Skia) — no system
10
+ Cairo, no native build step. A free, local alternative to
11
+ [labelary.com/viewer.html](https://labelary.com/viewer.html).
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @zebrash/node
17
+ ```
18
+
19
+ `@napi-rs/canvas` ships prebuilt Skia binaries for macOS, Linux, and Windows on
20
+ both x64 and arm64.
21
+
22
+ ## Usage
23
+
24
+ ```ts
25
+ import { readFile, writeFile } from "node:fs/promises";
26
+ import { Parser, Drawer } from "@zebrash/node";
27
+
28
+ const zpl = await readFile("./label.zpl");
29
+ const labels = new Parser().parse(zpl);
30
+
31
+ const png = await new Drawer().drawLabelAsPng(labels[0], {
32
+ labelWidthMm: 101.6, // 4 in
33
+ labelHeightMm: 203.2, // 8 in
34
+ dpmm: 8, // 203 dpi
35
+ });
36
+
37
+ await writeFile("./label.png", png);
38
+ ```
39
+
40
+ A single `^XA…^XZ` block produces one `LabelInfo`. Multi-label ZPL with
41
+ `^DF`/`^XF` template recall produces several — iterate the array.
42
+
43
+ ## SVG output
44
+
45
+ ```ts
46
+ const svg = await new Drawer().drawLabelAsSvg(labels[0], {
47
+ labelWidthMm: 101.6,
48
+ labelHeightMm: 203.2,
49
+ dpmm: 8,
50
+ fontEmbed: "url", // "url" | "embed" | "none"
51
+ });
52
+ ```
53
+
54
+ Returns a `Promise<string>`. Real `<rect>` per barcode module, real `<text>`
55
+ per `^FD` field. Only `^GF` bitmaps fall back to embedded raster.
56
+
57
+ ## Browser?
58
+
59
+ Use [`@zebrash/browser`](https://www.npmjs.com/package/@zebrash/browser) — same
60
+ API, `OffscreenCanvas` instead of Skia, zero native deps.
61
+
62
+ ## Documentation
63
+
64
+ Full docs, supported ZPL command surface, and the `DrawerOptions` reference
65
+ live in the [main README](https://github.com/Fountain-Bio/zebrash-ts#readme).
66
+
67
+ ## License
68
+
69
+ MIT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zebrash/node",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Render ZPL labels to PNG or SVG on Node.js and Bun. Pure TypeScript port of ingridhq/zebrash.",
5
5
  "keywords": [
6
6
  "barcode",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@napi-rs/canvas": "^0.1.100",
47
- "@zebrash/core": "1.0.1",
47
+ "@zebrash/core": "1.0.3",
48
48
  "fflate": "^0.8.2"
49
49
  },
50
50
  "engines": {