packed

tcmts.store.packed · #huvwqzlf · term · runs on the server

uses node:zlib

A text as the codebase keeps it: a long one zstd-compressed, as bytes, in the column that would hold it (a definition's code and source, metadata, a namespace node); a short one as itself. unpacked reads either.

import { PACK_FROM } from "#codebase/tcmts/store";
import { zstdCompressSync } from "node:zlib";

export function packed(text: string): string | Uint8Array {
  return text.length < PACK_FROM ? text : zstdCompressSync(text);
}

uses

used by