nodescad
v2.0.0
Published
Node.js wrapper for OpenSCAD
Readme
NodeSCAD
Node.js wrapper for OpenSCAD. Modern TypeScript, ESM-only, Promise-based.
Installation
npm install nodescadRequires Node.js 18+ and an installed OpenSCAD binary.
Usage
import { render, renderFile } from "nodescad"
// Render from a file
const result = await renderFile("path/to/file.scad", {
binaryPath: "/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD",
})
console.log(result.buffer?.length)
// Render from an inline string
const inline = await render({
input: "cube([2,3,4]);",
binaryPath: "openscad",
})
// Write straight to disk (no buffer returned in result)
await render({
inputFile: "model.scad",
outputFile: "model.stl",
})The full set of options is documented by the RenderOptions type in
src/types.ts.
Development
npm install
npm run typecheck # strict TS checks across src + tests
npm run build # emit dist/
npm test # node:test runner via tsx (needs OpenSCAD installed)