@tinyfiles/node
v0.1.1
Published
AT-1 (Atom Teleporter) verified-lossless decoder -- native Node N-API addon over the C ABI (all backends + codecs)
Maintainers
Readme
@tinyfiles/node — native Node binding (N-API)
A native Node addon over the AT-1 decoder C ABI. Unlike the WASM build, this path
supports all backends (xz, zstd, stored) and all codecs (including qcolumnar),
because it loads the full decoder shared library at runtime.
const at1 = require('@tinyfiles/node');
const original = at1.decode(at1Bytes); // Buffer | Uint8Array -> Buffer
console.log(at1.version());A clean npm i @tinyfiles/node needs no compiler: the launcher pulls in the
matching prebuilt platform package @tinyfiles/node-<os>-<arch> (carrying the
prebuilt at1_napi.node + the bundled decoder shared library) via
optionalDependencies. The build steps below are only for local development.
The addon dlopens the decoder library at startup. Resolution order:
AT1_DECODER_LIB env var → next to the package → ../../c_decoder/<lib>
(at1decode.dll / libat1decode.so / libat1decode.dylib).
Build
The shared decoder library must exist first:
cd c_decoder && make # builds libat1decode.* (and the CLI)
# Windows/mingw: gcc -O2 -DAT1_NO_MAIN -shared -o at1decode.dll at1_decode.c -llzma -lzstdThen build the addon:
npm install # runs node-gyp rebuild
# or, if node-gyp can't find your VS install (standalone Build Tools not registered
# with vswhere), build with MSVC directly using the cached node headers/lib:
cmd /c build_msvc.cmd # Windows fallback -> build/Release/at1_napi.nodeTest
node test.jsVerified: decodes all 11 committed vectors byte-identically (every backend + codec,
including xz and qcolumnar) plus a malformed-input rejection check — 12/12.
Why an addon that loads a shared lib instead of compiling the decoder in? It keeps the addon tiny and free of any link-time dependency on liblzma/libzstd — those ship inside the decoder library, which is built once with the normal C toolchain.
