# @suaveplan/bitpacker - Core bit-level binary packing: BitWriter, BitReader, BitPacker, and strategy manager ## Summary Core bit-level binary packing library. Provides `BitWriter`, `BitReader`, `BitPacker`, and a pluggable strategy system for schema-driven serialization. ## Documentation tree - [bit-reader](./src/bit-reader/bit-reader.md) — _(no submodules)_ - index — **Path:** `bitpacker/src/bit-reader/index.t… - [bit-reader](./src/bit-reader/bit-reader.md) — _(no submodules)_ - index — **Path:** `bitpacker/src/bit-reader/index.t… - [index](./src/bit-reader/index.md) — **Path:** `bitpacker/src/bit-reader/index.ts` **Export:** See source for details. - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_ - index — **Path:** `bitpacker/src/bit-writer/index.t… - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_ - index — **Path:** `bitpacker/src/bit-writer/index.t… - [index](./src/bit-writer/index.md) — **Path:** `bitpacker/src/bit-writer/index.ts` **Export:** See source for details. - [safety](./src/core/safety/safety-checks.md) — _(no submodules)_ - [safety-checks](./src/core/safety/safety-checks.md) — _(no submodules)_ - [invalid](./src/core/strategies/invalid.md) — **Path:** `bitpacker/src/core/strategies/invalid.ts` **Export:** See source for details. - [manager](./src/core/strategies/manager.md) — **Path:** `src/core/strategies/manager.ts` **Export:** `PackingStrategyManager` (class) - [types](./src/core/strategies/types.md) — **Path:** `src/core/strategies/types.ts` **Export:** `PackingStrategy` (interface), `PackingContext` (interface) - [types.schema](./src/core/strategies/types.schema.md) — Zod schemas for `PackingStrategy` and `PackingContext`, the two extension-point types that flow across the `@suaveplan/… - [bitpacker](./src/core/bitpacker.md) — **Path:** `src/core/bitpacker.ts` **Export:** `BitPacker` (class), `BitPackerOptions` (interface) - [bitpacker.schema](./src/core/bitpacker.schema.md) — Zod schema for `BitPackerOptions`, the configuration bundle accepted by the `BitPacker` class constructor. It validates… - [error-codes](./src/error-codes/error-codes.md) — **Path:** `bitpacker/src/error-codes.ts` **Export:** See source for details. - [error-codes](./src/error-codes/error-codes.md) — **Path:** `bitpacker/src/error-codes.ts` **Export:** See source for details. - [handlers](./src/handlers/custom-type-registry.md) — _(no submodules)_ - [custom-type-registry](./src/handlers/custom-type-registry.md) — _(no submodules)_ - [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_ - [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_ - [otel](./src/otel/instruments.md) — _(no submodules)_ - [instruments](./src/otel/instruments.md) — _(no submodules)_ - [packers](./src/packers/index.md) — _(no submodules)_ - array-packer — _(no submodu… - [array](./src/packers/array/array-packer.md) — _(no submodules)_ - [array-packer](./src/packers/array/array-packer.md) — _(no submodules)_ - [base](./src/packers/base/base-packer.md) — _(no submodules)_ - [base-packer](./src/packers/base/base-packer.md) — _(no submodules)_ - [bigint](./src/packers/bigint/bigint-packer.md) — _(no submodules)_ - [bigint-packer](./src/packers/bigint/bigint-packer.md) — _(no submodules)_ - [bigint-array](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_ - [bigint-array-packer](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_ - [bit-array](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_ - [bit-array-packer](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_ - [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_ - [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_ - [boolean](./src/packers/boolean/boolean-packer.md) — _(no submodules)_ - [boolean-packer](./src/packers/boolean/boolean-packer.md) — _(no submodules)_ - [datetime](./src/packers/datetime/datetime-packer.md) — _(no submodules)_ - [datetime-packer](./src/packers/datetime/datetime-packer.md) — _(no submodules)_ - [enum](./src/packers/enum/enum-packer.md) — _(no submodules)_ - [enum-packer](./src/packers/enum/enum-packer.md) — _(no submodules)_ - [float](./src/packers/float/float-packer.md) — _(no submodules)_ - [float-packer](./src/packers/float/float-packer.md) — _(no submodules)_ - [integer](./src/packers/integer/integer-packer.md) — _(no submodules)_ - [integer-packer](./src/packers/integer/integer-packer.md) — _(no submodules)_ - [map](./src/packers/map/map-packer.md) — _(no submodules)_ - [map-packer](./src/packers/map/map-packer.md) — _(no submodules)_ - [set](./src/packers/set/set-packer.md) — _(no submodules)_ - [set-packer](./src/packers/set/set-packer.md) — _(no submodules)_ - [string](./src/packers/string/string-packer.md) — _(no submodules)_ - [string-packer](./src/packers/string/string-packer.md) — _(no submodules)_ - [uuid](./src/packers/uuid/uuid-packer.md) — _(no submodules)_ - [uuid-packer](./src/packers/uuid/uuid-packer.md) — _(no submodules)_ - [varint](./src/packers/varint/varint-packer.md) — _(no submodules)_ - [varint-packer](./src/packers/varint/varint-packer.md) — _(no submodules)_ - [index](./src/packers/index.md) — _(no submodules)_ - array-packer — _(no submodu… - [performance](./src/performance/performance.md) — _(no submodules)_ - [buffer-pool](./src/performance/buffer-pool.md) — Reusable `Uint8Array` pool for the bitpacker hot path. Instead of allocating a fresh buffer per pack/unpack call (which… - [lru-cache](./src/performance/lru-cache.md) — Bounded-size LRU (least-recently-used) cache used to memoize expensive bitpacker computations: schema-to-bit-width deri… - [performance-monitor](./src/performance/performance-monitor.md) — Lightweight performance instrumentation for `@suaveplan/bitpacker`'s hot path. `PerformanceMonitor` collects per-operat… - [performance](./src/performance/performance.md) — _(no submodules)_ - [register-schemas](./src/register-schemas/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the core `@suaveplan/bitpacker` package. Exposes a single… - [register-schemas](./src/register-schemas/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the core `@suaveplan/bitpacker` package. Exposes a single… - [serialization](./src/serialization/serialization.md) — _(no submodules)_ - [serialization](./src/serialization/serialization.md) — _(no submodules)_ - [base-types](./src/types/base-types.md) — Foundation type companions for the bitpacker — the typed-array unions (`IntArray`, `FloatArray`), the integer/float typ… - [common](./src/types/common.md) — **Path:** `bitpacker/src/types/common.ts` **Export:** See source for details. - [index](./src/types/index.md) — **Path:** `src/types/index.ts` **Exports:** Schema type definitions, type guards, utility types - [key-types](./src/types/key-types.md) — Public type companions for the legacy key-material API. `BitPackerKey` is the canonical byte-array alias for any signin… - [packer-types](./src/types/packer-types.md) — Public configuration types for the legacy `BitPackerConfig` surface — the all-in-one options bundle that pre-modular bi… - [schema-versioning-types](./src/types/schema-versioning-types.md) — Type companions for the schema-version migration framework — `SchemaVersion`, `MigrationFunction`, `SchemaMigration`, `… - [schemas](./src/types/schemas.md) — **Path:** `src/types.ts` **Export:** Schema type guards, `BitPackerSchema` union, token types - [validation-types](./src/types/validation-types.md) — Type companions for the legacy validation API surfaced from `@suaveplan/bitpacker`'s root export. These types — `BitPac… - [types.schema](./src/types.schema/types.schema.md) — Zod schemas for the recursive `BitPackerSchema` union and every variant it can take. These schemas are the single sourc… - [types.schema](./src/types.schema/types.schema.md) — Zod schemas for the recursive `BitPackerSchema` union and every variant it can take. These schemas are the single sourc… - [utils](./src/utils/utils.md) — _(no submodules)_ - zigzag — **Path:** `bitpacker/src/utils/zigzag.ts`…… - [float-utils](./src/utils/float-utils.md) — Float-bit-pattern conversion helpers used by the float packer and any consumer that needs to round-trip a `number` thro… - [pack-bits](./src/utils/pack-bits.md) — **Path:** `bitpacker/src/utils/pack-bits.ts` **Export:** See source for details. - [schema-validators](./src/utils/schema-validators.md) — Per-shape schema validation helpers used internally by `@suaveplan/bitpacker`'s legacy validator surface. Each function… - [type-guards](./src/utils/type-guards.md) — Generic type-guard helpers used across `@suaveplan/bitpacker` for safe narrowing of `unknown` values into well-typed sh… - [utils](./src/utils/utils.md) — _(no submodules)_ - zigzag — **Path:** `bitpacker/src/utils/zigzag.ts`…… - [zigzag](./src/utils/zigzag.md) — **Path:** `bitpacker/src/utils/zigzag.ts` **Export:** See source for details. - [bit-schema](./src/bit-schema.md) — **Path:** `src/bit-schema.ts` **Export:** `defineBitSchema` (function) - [index](./src/index.md) — **Path:** `bitpacker/src/index.ts` **Export:** See source for details. - index — **Path:** `bitpacker/src/bit-reader/index.t… - [bit-reader](./src/bit-reader/bit-reader.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-reader/index.t… - [index](./src/bit-reader/index.md) — **Path:** `bitpacker/src/bit-reader/index.ts` **Export:** See source for details. - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-writer/index.t… - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-writer/index.t… - [index](./src/bit-writer/index.md) — **Path:** `bitpacker/src/bit-writer/index.ts` **Export:** See source for details. - [safety](./src/core/safety/safety-checks.md) — _(no submodules)_- [safety-checks](./src/core/safety/safety-checks.md) — _(no submodules)_- [invalid](./src/core/strategies/invalid.md) — **Path:** `bitpacker/src/core/strategies/invalid.ts` **Export:** See source for details. - [manager](./src/core/strategies/manager.md) — **Path:** `src/core/strategies/manager.ts` **Export:** `PackingStrategyManager` (class) - [types](./src/core/strategies/types.md) — **Path:** `src/core/strategies/types.ts` **Export:** `PackingStrategy` (interface), `PackingContext` (interface) - [types.schema](./src/core/strategies/types.schema.md) — Zod schemas for `PackingStrategy` and `PackingContext`, the two extension-point types that flow across the `@suaveplan/… - [bitpacker](./src/core/bitpacker.md) — **Path:** `src/core/bitpacker.ts` **Export:** `BitPacker` (class), `BitPackerOptions` (interface) - [bitpacker.schema](./src/core/bitpacker.schema.md) — Zod schema for `BitPackerOptions`, the configuration bundle accepted by the `BitPacker` class constructor. It validates… - [handlers](./src/handlers/custom-type-registry.md) — _(no submodules)_- [custom-type-registry](./src/handlers/custom-type-registry.md) — _(no submodules)_- [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_- [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_- [otel](./src/otel/instruments.md) — _(no submodules)_- [instruments](./src/otel/instruments.md) — _(no submodules)_- [packers](./src/packers/index.md) — _(no submodules)_- [array](./src/packers/array/array-packer.md) — _(no submodules)_- [array-packer](./src/packers/array/array-packer.md) — _(no submodules)_- [base](./src/packers/base/base-packer.md) — _(no submodules)_- [base-packer](./src/packers/base/base-packer.md) — _(no submodules)_- [bigint](./src/packers/bigint/bigint-packer.md) — _(no submodules)_- [bigint-packer](./src/packers/bigint/bigint-packer.md) — _(no submodules)_- [bigint-array](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_- [bigint-array-packer](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_- [bit-array](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_- [bit-array-packer](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_- [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_- [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_- [boolean](./src/packers/boolean/boolean-packer.md) — _(no submodules)_- [boolean-packer](./src/packers/boolean/boolean-packer.md) — _(no submodules)_- [datetime](./src/packers/datetime/datetime-packer.md) — _(no submodules)_- [datetime-packer](./src/packers/datetime/datetime-packer.md) — _(no submodules)_- [enum](./src/packers/enum/enum-packer.md) — _(no submodules)_- [enum-packer](./src/packers/enum/enum-packer.md) — _(no submodules)_- [float](./src/packers/float/float-packer.md) — _(no submodules)_- [float-packer](./src/packers/float/float-packer.md) — _(no submodules)_- [integer](./src/packers/integer/integer-packer.md) — _(no submodules)_- [integer-packer](./src/packers/integer/integer-packer.md) — _(no submodules)_- [map](./src/packers/map/map-packer.md) — _(no submodules)_- [map-packer](./src/packers/map/map-packer.md) — _(no submodules)_- [set](./src/packers/set/set-packer.md) — _(no submodules)_- [set-packer](./src/packers/set/set-packer.md) — _(no submodules)_- [string](./src/packers/string/string-packer.md) — _(no submodules)_- [string-packer](./src/packers/string/string-packer.md) — _(no submodules)_- [uuid](./src/packers/uuid/uuid-packer.md) — _(no submodules)_- [uuid-packer](./src/packers/uuid/uuid-packer.md) — _(no submodules)_- [varint](./src/packers/varint/varint-packer.md) — _(no submodules)_- [varint-packer](./src/packers/varint/varint-packer.md) — _(no submodules)_- [index](./src/packers/index.md) — _(no submodules)_- [performance](./src/performance/performance.md) — _(no submodules)_- [buffer-pool](./src/performance/buffer-pool.md) — Reusable `Uint8Array` pool for the bitpacker hot path. Instead of allocating a fresh buffer per pack/unpack call (which… - [lru-cache](./src/performance/lru-cache.md) — Bounded-size LRU (least-recently-used) cache used to memoize expensive bitpacker computations: schema-to-bit-width deri… - [performance-monitor](./src/performance/performance-monitor.md) — Lightweight performance instrumentation for `@suaveplan/bitpacker`'s hot path. `PerformanceMonitor` collects per-operat… - [performance](./src/performance/performance.md) — _(no submodules)_- [serialization](./src/serialization/serialization.md) — _(no submodules)_- [serialization](./src/serialization/serialization.md) — _(no submodules)_- [base-types](./src/types/base-types.md) — Foundation type companions for the bitpacker — the typed-array unions (`IntArray`, `FloatArray`), the integer/float typ… - [common](./src/types/common.md) — **Path:** `bitpacker/src/types/common.ts` **Export:** See source for details. - [index](./src/types/index.md) — **Path:** `src/types/index.ts` **Exports:** Schema type definitions, type guards, utility types - [key-types](./src/types/key-types.md) — Public type companions for the legacy key-material API. `BitPackerKey` is the canonical byte-array alias for any signin… - [packer-types](./src/types/packer-types.md) — Public configuration types for the legacy `BitPackerConfig` surface — the all-in-one options bundle that pre-modular bi… - [schema-versioning-types](./src/types/schema-versioning-types.md) — Type companions for the schema-version migration framework — `SchemaVersion`, `MigrationFunction`, `SchemaMigration`, `… - [validation-types](./src/types/validation-types.md) — Type companions for the legacy validation API surfaced from `@suaveplan/bitpacker`'s root export. These types — `BitPac… - [utils](./src/utils/utils.md) — _(no submodules)_- zigzag — **Path:** `bitpacker/src/utils/zigzag.ts`…… - [float-utils](./src/utils/float-utils.md) — Float-bit-pattern conversion helpers used by the float packer and any consumer that needs to round-trip a `number` thro… - [pack-bits](./src/utils/pack-bits.md) — **Path:** `bitpacker/src/utils/pack-bits.ts` **Export:** See source for details. - [schema-validators](./src/utils/schema-validators.md) — Per-shape schema validation helpers used internally by `@suaveplan/bitpacker`'s legacy validator surface. Each function… - [type-guards](./src/utils/type-guards.md) — Generic type-guard helpers used across `@suaveplan/bitpacker` for safe narrowing of `unknown` values into well-typed sh… - [utils](./src/utils/utils.md) — _(no submodules)_- zigzag — **Path:** `bitpacker/src/utils/zigzag.ts`…… - [zigzag](./src/utils/zigzag.md) — **Path:** `bitpacker/src/utils/zigzag.ts` **Export:** See source for details. - [bit-schema](./src/bit-schema.md) — **Path:** `src/bit-schema.ts` **Export:** `defineBitSchema` (function) - [error-codes](./src/error-codes.md) — **Path:** `bitpacker/src/error-codes.ts` **Export:** See source for details. - [index](./src/index.md) — **Path:** `bitpacker/src/index.ts` **Export:** See source for details. - [register-schemas](./src/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the core `@suaveplan/bitpacker` package. Exposes a single… - [types](./src/types.md) — **Path:** `src/types.ts` **Export:** Schema type guards, `BitPackerSchema` union, token types - [types.schema](./src/types.schema.md) — Zod schemas for the recursive `BitPackerSchema` union and every variant it can take. These schemas are the single sourc… - index — **Path:** `bitpacker/src/bit-reader/index.t… - [bit-reader](./src/bit-reader/bit-reader.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-reader/index.t… - [index](./src/bit-reader/index.md) — **Path:** `bitpacker/src/bit-reader/index.ts` **Export:** See source for details. - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-writer/index.t… - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-writer/index.t… - [index](./src/bit-writer/index.md) — **Path:** `bitpacker/src/bit-writer/index.ts` **Export:** See source for details. - [safety](./src/core/safety/safety-checks.md) — _(no submodules)_- [safety-checks](./src/core/safety/safety-checks.md) — _(no submodules)_- [invalid](./src/core/strategies/invalid.md) — **Path:** `bitpacker/src/core/strategies/invalid.ts` **Export:** See source for details. - [manager](./src/core/strategies/manager.md) — **Path:** `src/core/strategies/manager.ts` **Export:** `PackingStrategyManager` (class) - [types](./src/core/strategies/types.md) — **Path:** `src/core/strategies/types.ts` **Export:** `PackingStrategy` (interface), `PackingContext` (interface) - [types.schema](./src/core/strategies/types.schema.md) — Zod schemas for `PackingStrategy` and `PackingContext`, the two extension-point types that flow across the `@suaveplan/… - [bitpacker](./src/core/bitpacker.md) — **Path:** `src/core/bitpacker.ts` **Export:** `BitPacker` (class), `BitPackerOptions` (interface) - [bitpacker.schema](./src/core/bitpacker.schema.md) — Zod schema for `BitPackerOptions`, the configuration bundle accepted by the `BitPacker` class constructor. It validates… - [handlers](./src/handlers/custom-type-registry.md) — _(no submodules)_- [custom-type-registry](./src/handlers/custom-type-registry.md) — _(no submodules)_- [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_- [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_- [otel](./src/otel/instruments.md) — _(no submodules)_- [instruments](./src/otel/instruments.md) — _(no submodules)_- [packers](./src/packers/index.md) — _(no submodules)_- array-packer — _(no submodules)_- [array-packer](./src/packers/array/array-packer.md) — _(no submodules)_- [base](./src/packers/base/base-packer.md) — _(no submodules)_- [base-packer](./src/packers/base/base-packer.md) — _(no submodules)_- [bigint](./src/packers/bigint/bigint-packer.md) — _(no submodules)_- [bigint-packer](./src/packers/bigint/bigint-packer.md) — _(no submodules)_- [bigint-array](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_- [bigint-array-packer](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_- [bit-array](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_- [bit-array-packer](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_- [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_- [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_- [boolean](./src/packers/boolean/boolean-packer.md) — _(no submodules)_- [boolean-packer](./src/packers/boolean/boolean-packer.md) — _(no submodules)_- [datetime](./src/packers/datetime/datetime-packer.md) — _(no submodules)_- [datetime-packer](./src/packers/datetime/datetime-packer.md) — _(no submodules)_- [enum](./src/packers/enum/enum-packer.md) — _(no submodules)_- [enum-packer](./src/packers/enum/enum-packer.md) — _(no submodules)_- [float](./src/packers/float/float-packer.md) — _(no submodules)_- [float-packer](./src/packers/float/float-packer.md) — _(no submodules)_- [integer](./src/packers/integer/integer-packer.md) — _(no submodules)_- [integer-packer](./src/packers/integer/integer-packer.md) — _(no submodules)_- [map](./src/packers/map/map-packer.md) — _(no submodules)_- [map-packer](./src/packers/map/map-packer.md) — _(no submodules)_- [set](./src/packers/set/set-packer.md) — _(no submodules)_- [set-packer](./src/packers/set/set-packer.md) — _(no submodules)_- [string](./src/packers/string/string-packer.md) — _(no submodules)_- [string-packer](./src/packers/string/string-packer.md) — _(no submodules)_- [uuid](./src/packers/uuid/uuid-packer.md) — _(no submodules)_- [uuid-packer](./src/packers/uuid/uuid-packer.md) — _(no submodules)_- [varint](./src/packers/varint/varint-packer.md) — _(no submodules)_- [varint-packer](./src/packers/varint/varint-packer.md) — _(no submodules)_- [index](./src/packers/index.md) — _(no submodules)_- array-packer — _(no submodules)_- [buffer-pool](./src/performance/buffer-pool.md) — Reusable `Uint8Array` pool for the bitpacker hot path. Instead of allocating a fresh buffer per pack/unpack call (which… - [lru-cache](./src/performance/lru-cache.md) — Bounded-size LRU (least-recently-used) cache used to memoize expensive bitpacker computations: schema-to-bit-width deri… - [performance-monitor](./src/performance/performance-monitor.md) — Lightweight performance instrumentation for `@suaveplan/bitpacker`'s hot path. `PerformanceMonitor` collects per-operat… - [performance](./src/performance/performance.md) — _(no submodules)_- [serialization](./src/serialization/serialization.md) — _(no submodules)_- [serialization](./src/serialization/serialization.md) — _(no submodules)_- [base-types](./src/types/base-types.md) — Foundation type companions for the bitpacker — the typed-array unions (`IntArray`, `FloatArray`), the integer/float typ… - [common](./src/types/common.md) — **Path:** `bitpacker/src/types/common.ts` **Export:** See source for details. - [index](./src/types/index.md) — **Path:** `src/types/index.ts` **Exports:** Schema type definitions, type guards, utility types - [key-types](./src/types/key-types.md) — Public type companions for the legacy key-material API. `BitPackerKey` is the canonical byte-array alias for any signin… - [packer-types](./src/types/packer-types.md) — Public configuration types for the legacy `BitPackerConfig` surface — the all-in-one options bundle that pre-modular bi… - [schema-versioning-types](./src/types/schema-versioning-types.md) — Type companions for the schema-version migration framework — `SchemaVersion`, `MigrationFunction`, `SchemaMigration`, `… - [validation-types](./src/types/validation-types.md) — Type companions for the legacy validation API surfaced from `@suaveplan/bitpacker`'s root export. These types — `BitPac… - [utils](./src/utils/utils.md) — _(no submodules)_- zigzag — **Path:** `bitpacker/src/utils/zigzag.ts`…… - [float-utils](./src/utils/float-utils.md) — Float-bit-pattern conversion helpers used by the float packer and any consumer that needs to round-trip a `number` thro… - [pack-bits](./src/utils/pack-bits.md) — **Path:** `bitpacker/src/utils/pack-bits.ts` **Export:** See source for details. - [schema-validators](./src/utils/schema-validators.md) — Per-shape schema validation helpers used internally by `@suaveplan/bitpacker`'s legacy validator surface. Each function… - [type-guards](./src/utils/type-guards.md) — Generic type-guard helpers used across `@suaveplan/bitpacker` for safe narrowing of `unknown` values into well-typed sh… - [utils](./src/utils/utils.md) — _(no submodules)_- zigzag — **Path:** `bitpacker/src/utils/zigzag.ts`…… - [zigzag](./src/utils/zigzag.md) — **Path:** `bitpacker/src/utils/zigzag.ts` **Export:** See source for details. - [bit-schema](./src/bit-schema.md) — **Path:** `src/bit-schema.ts` **Export:** `defineBitSchema` (function) - [error-codes](./src/error-codes.md) — **Path:** `bitpacker/src/error-codes.ts` **Export:** See source for details. - [index](./src/index.md) — **Path:** `bitpacker/src/index.ts` **Export:** See source for details. - [register-schemas](./src/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the core `@suaveplan/bitpacker` package. Exposes a single… - [types](./src/types.md) — **Path:** `src/types.ts` **Export:** Schema type guards, `BitPackerSchema` union, token types - [types.schema](./src/types.schema.md) — Zod schemas for the recursive `BitPackerSchema` union and every variant it can take. These schemas are the single sourc… - index — **Path:** `bitpacker/src/bit-reader/index.t… - [bit-reader](./src/bit-reader/bit-reader.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-reader/index.t… - [index](./src/bit-reader/index.md) — **Path:** `bitpacker/src/bit-reader/index.ts` **Export:** See source for details. - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-writer/index.t… - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_- index — **Path:** `bitpacker/src/bit-writer/index.t… - [index](./src/bit-writer/index.md) — **Path:** `bitpacker/src/bit-writer/index.ts` **Export:** See source for details. - [safety](./src/core/safety/safety-checks.md) — _(no submodules)_- [safety-checks](./src/core/safety/safety-checks.md) — _(no submodules)_- [invalid](./src/core/strategies/invalid.md) — **Path:** `bitpacker/src/core/strategies/invalid.ts` **Export:** See source for details. - [manager](./src/core/strategies/manager.md) — **Path:** `src/core/strategies/manager.ts` **Export:** `PackingStrategyManager` (class) - [types](./src/core/strategies/types.md) — **Path:** `src/core/strategies/types.ts` **Export:** `PackingStrategy` (interface), `PackingContext` (interface) - [types.schema](./src/core/strategies/types.schema.md) — Zod schemas for `PackingStrategy` and `PackingContext`, the two extension-point types that flow across the `@suaveplan/… - [bitpacker](./src/core/bitpacker.md) — **Path:** `src/core/bitpacker.ts` **Export:** `BitPacker` (class), `BitPackerOptions` (interface) - [bitpacker.schema](./src/core/bitpacker.schema.md) — Zod schema for `BitPackerOptions`, the configuration bundle accepted by the `BitPacker` class constructor. It validates… - [handlers](./src/handlers/custom-type-registry.md) — _(no submodules)_- [custom-type-registry](./src/handlers/custom-type-registry.md) — _(no submodules)_- [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_- [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_- [otel](./src/otel/instruments.md) — _(no submodules)_- [instruments](./src/otel/instruments.md) — _(no submodules)_- [packers](./src/packers/index.md) — _(no submodules)_- array-packer — _(no submod… - [array](./src/packers/array/array-packer.md) — _(no submodules)_- [array-packer](./src/packers/array/array-packer.md) — _(no submodules)_- [base](./src/packers/base/base-packer.md) — _(no submodules)_- [base-packer](./src/packers/base/base-packer.md) — _(no submodules)_- [bigint](./src/packers/bigint/bigint-packer.md) — _(no submodules)_- [bigint-packer](./src/packers/bigint/bigint-packer.md) — _(no submodules)_- [bigint-array](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_- [bigint-array-packer](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_- [bit-array](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_- [bit-array-packer](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_- [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_- [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_- [boolean](./src/packers/boolean/boolean-packer.md) — _(no submodules)_- [boolean-packer](./src/packers/boolean/boolean-packer.md) — _(no submodules)_- [datetime](./src/packers/datetime/datetime-packer.md) — _(no submodules)_- [datetime-packer](./src/packers/datetime/datetime-packer.md) — _(no submodules)_- [enum](./src/packers/enum/enum-packer.md) — _(no submodules)_- [enum-packer](./src/packers/enum/enum-packer.md) — _(no submodules)_- [float](./src/packers/float/float-packer.md) — _(no submodules)_- [float-packer](./src/packers/float/float-packer.md) — _(no submodules)_- [integer](./src/packers/integer/integer-packer.md) — _(no submodules)_- [integer-packer](./src/packers/integer/integer-packer.md) — _(no submodules)_- [map](./src/packers/map/map-packer.md) — _(no submodules)_- [map-packer](./src/packers/map/map-packer.md) — _(no submodules)_- [set](./src/packers/set/set-packer.md) — _(no submodules)_- [set-packer](./src/packers/set/set-packer.md) — _(no submodules)_- [string](./src/packers/string/string-packer.md) — _(no submodules)_- [string-packer](./src/packers/string/string-packer.md) — _(no submodules)_- [uuid](./src/packers/uuid/uuid-packer.md) — _(no submodules)_- [uuid-packer](./src/packers/uuid/uuid-packer.md) — _(no submodules)_- [varint](./src/packers/varint/varint-packer.md) — _(no submodules)_- [varint-packer](./src/packers/varint/varint-packer.md) — _(no submodules)_- [index](./src/packers/index.md) — _(no submodules)_- array-packer — _(no submod… - [performance](./src/performance/performance.md) — _(no submodules)_- [buffer-pool](./src/performance/buffer-pool.md) — Reusable `Uint8Array` pool for the bitpacker hot path. Instead of allocating a fresh buffer per pack/unpack call (which… - [lru-cache](./src/performance/lru-cache.md) — Bounded-size LRU (least-recently-used) cache used to memoize expensive bitpacker computations: schema-to-bit-width deri… - [performance-monitor](./src/performance/performance-monitor.md) — Lightweight performance instrumentation for `@suaveplan/bitpacker`'s hot path. `PerformanceMonitor` collects per-operat… - [performance](./src/performance/performance.md) — _(no submodules)_- [serialization](./src/serialization/serialization.md) — _(no submodules)_- [serialization](./src/serialization/serialization.md) — _(no submodules)_- [base-types](./src/types/base-types.md) — Foundation type companions for the bitpacker — the typed-array unions (`IntArray`, `FloatArray`), the integer/float typ… - [common](./src/types/common.md) — **Path:** `bitpacker/src/types/common.ts` **Export:** See source for details. - [index](./src/types/index.md) — **Path:** `src/types/index.ts` **Exports:** Schema type definitions, type guards, utility types - [key-types](./src/types/key-types.md) — Public type companions for the legacy key-material API. `BitPackerKey` is the canonical byte-array alias for any signin… - [packer-types](./src/types/packer-types.md) — Public configuration types for the legacy `BitPackerConfig` surface — the all-in-one options bundle that pre-modular bi… - [schema-versioning-types](./src/types/schema-versioning-types.md) — Type companions for the schema-version migration framework — `SchemaVersion`, `MigrationFunction`, `SchemaMigration`, `… - [validation-types](./src/types/validation-types.md) — Type companions for the legacy validation API surfaced from `@suaveplan/bitpacker`'s root export. These types — `BitPac… - [utils](./src/utils/utils.md) — _(no submodules)_- zigzag — **Path:** `bitpacker/src/utils/zigzag.ts`… - [float-utils](./src/utils/float-utils.md) — Float-bit-pattern conversion helpers used by the float packer and any consumer that needs to round-trip a `number` thro… - [pack-bits](./src/utils/pack-bits.md) — **Path:** `bitpacker/src/utils/pack-bits.ts` **Export:** See source for details. - [schema-validators](./src/utils/schema-validators.md) — Per-shape schema validation helpers used internally by `@suaveplan/bitpacker`'s legacy validator surface. Each function… - [type-guards](./src/utils/type-guards.md) — Generic type-guard helpers used across `@suaveplan/bitpacker` for safe narrowing of `unknown` values into well-typed sh… - [utils](./src/utils/utils.md) — _(no submodules)_- zigzag — **Path:** `bitpacker/src/utils/zigzag.ts`… - [zigzag](./src/utils/zigzag.md) — **Path:** `bitpacker/src/utils/zigzag.ts` **Export:** See source for details. - [bit-schema](./src/bit-schema.md) — **Path:** `src/bit-schema.ts` **Export:** `defineBitSchema` (function) - [error-codes](./src/error-codes.md) — **Path:** `bitpacker/src/error-codes.ts` **Export:** See source for details. - [index](./src/index.md) — **Path:** `bitpacker/src/index.ts` **Export:** See source for details. - [register-schemas](./src/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the core `@suaveplan/bitpacker` package. Exposes a single… - [types](./src/types.md) — **Path:** `src/types.ts` **Export:** Schema type guards, `BitPackerSchema` union, token types - [types.schema](./src/types.schema.md) — Zod schemas for the recursive `BitPackerSchema` union and every variant it can take. These schemas are the single sourc… - [bit-reader](./src/bit-reader/bit-reader.md) — _(no submodules)_- [index](./src/bit-reader/index.md) — **Path:** `bitpacker/src/bit-reader/index.ts` **Export:** See source for details. - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_ - [bit-writer](./src/bit-writer/bit-writer.md) — _(no submodules)_ - [index](./src/bit-writer/index.md) — **Path:** `bitpacker/src/bit-writer/index.ts` **Export:** See source for details. - [safety](./src/core/safety/safety-checks.md) — _(no submodules)_ - [safety-checks](./src/core/safety/safety-checks.md) — _(no submodules)_- [invalid](./src/core/strategies/invalid.md) — **Path:** `bitpacker/src/core/strategies/invalid.ts` **Export:** See source for details. - [manager](./src/core/strategies/manager.md) — **Path:** `src/core/strategies/manager.ts` **Export:** `PackingStrategyManager` (class) - [types](./src/core/strategies/types.md) — **Path:** `src/core/strategies/types.ts` **Export:** `PackingStrategy` (interface), `PackingContext` (interface) - [types.schema](./src/core/strategies/types.schema.md) — Zod schemas for `PackingStrategy` and `PackingContext`, the two extension-point types that flow across the `@suaveplan/… - [bitpacker](./src/core/bitpacker.md) — **Path:** `src/core/bitpacker.ts` **Export:** `BitPacker` (class), `BitPackerOptions` (interface) - [bitpacker.schema](./src/core/bitpacker.schema.md) — Zod schema for `BitPackerOptions`, the configuration bundle accepted by the `BitPacker` class constructor. It validates… - [handlers](./src/handlers/custom-type-registry.md) — _(no submodules)_ - [custom-type-registry](./src/handlers/custom-type-registry.md) — _(no submodules)_- [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_ - [pack-iterator](./src/iterators/pack-iterator/pack-iterator.md) — _(no submodules)_- [otel](./src/otel/instruments.md) — _(no submodules)_ - [instruments](./src/otel/instruments.md) — _(no submodules)_- [packers](./src/packers/index.md) — _(no submodules)_ - [array](./src/packers/array/array-packer.md) — _(no submodules)_ - [array-packer](./src/packers/array/array-packer.md) — _(no submodules)_ - [base](./src/packers/base/base-packer.md) — _(no submodules)_ - [base-packer](./src/packers/base/base-packer.md) — _(no submodules)_ - [bigint](./src/packers/bigint/bigint-packer.md) — _(no submodules)_ - [bigint-packer](./src/packers/bigint/bigint-packer.md) — _(no submodules)_ - [bigint-array](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_ - [bigint-array-packer](./src/packers/bigint-array/bigint-array-packer.md) — _(no submodules)_ - [bit-array](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_ - [bit-array-packer](./src/packers/bit-array/bit-array-packer.md) — _(no submodules)_ - [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_ - [bit-operations](./src/packers/bit-operations/bit-operations.md) — _(no submodules)_ - [boolean](./src/packers/boolean/boolean-packer.md) — _(no submodules)_ - [boolean-packer](./src/packers/boolean/boolean-packer.md) — _(no submodules)_ - [datetime](./src/packers/datetime/datetime-packer.md) — _(no submodules)_ - [datetime-packer](./src/packers/datetime/datetime-packer.md) — _(no submodules)_ - [enum](./src/packers/enum/enum-packer.md) — _(no submodules)_ - [enum-packer](./src/packers/enum/enum-packer.md) — _(no submodules)_ - [float](./src/packers/float/float-packer.md) — _(no submodules)_ - [float-packer](./src/packers/float/float-packer.md) — _(no submodules)_ - [integer](./src/packers/integer/integer-packer.md) — _(no submodules)_ - [integer-packer](./src/packers/integer/integer-packer.md) — _(no submodules)_ - [map](./src/packers/map/map-packer.md) — _(no submodules)_ - [map-packer](./src/packers/map/map-packer.md) — _(no submodules)_ - [set](./src/packers/set/set-packer.md) — _(no submodules)_ - [set-packer](./src/packers/set/set-packer.md) — _(no submodules)_ - [string](./src/packers/string/string-packer.md) — _(no submodules)_ - [string-packer](./src/packers/string/string-packer.md) — _(no submodules)_ - [uuid](./src/packers/uuid/uuid-packer.md) — _(no submodules)_ - [uuid-packer](./src/packers/uuid/uuid-packer.md) — _(no submodules)_ - [varint](./src/packers/varint/varint-packer.md) — _(no submodules)_ - [varint-packer](./src/packers/varint/varint-packer.md) — _(no submodules)_ - [index](./src/packers/index.md) — _(no submodules)_- [performance](./src/performance/performance.md) — _(no submodules)_ - [buffer-pool](./src/performance/buffer-pool.md) — Reusable `Uint8Array` pool for the bitpacker hot path. Instead of allocating a fresh buffer per pack/unpack call (which… - [lru-cache](./src/performance/lru-cache.md) — Bounded-size LRU (least-recently-used) cache used to memoize expensive bitpacker computations: schema-to-bit-width deri… - [performance-monitor](./src/performance/performance-monitor.md) — Lightweight performance instrumentation for `@suaveplan/bitpacker`'s hot path. `PerformanceMonitor` collects per-operat… - [performance](./src/performance/performance.md) — _(no submodules)_- [serialization](./src/serialization/serialization.md) — _(no submodules)_ - [serialization](./src/serialization/serialization.md) — _(no submodules)_- [base-types](./src/types/base-types.md) — Foundation type companions for the bitpacker — the typed-array unions (`IntArray`, `FloatArray`), the integer/float typ… - [common](./src/types/common.md) — **Path:** `bitpacker/src/types/common.ts` **Export:** See source for details. - [index](./src/types/index.md) — **Path:** `src/types/index.ts` **Exports:** Schema type definitions, type guards, utility types - [key-types](./src/types/key-types.md) — Public type companions for the legacy key-material API. `BitPackerKey` is the canonical byte-array alias for any signin… - [packer-types](./src/types/packer-types.md) — Public configuration types for the legacy `BitPackerConfig` surface — the all-in-one options bundle that pre-modular bi… - [schema-versioning-types](./src/types/schema-versioning-types.md) — Type companions for the schema-version migration framework — `SchemaVersion`, `MigrationFunction`, `SchemaMigration`, `… - [validation-types](./src/types/validation-types.md) — Type companions for the legacy validation API surfaced from `@suaveplan/bitpacker`'s root export. These types — `BitPac… - [utils](./src/utils/utils.md) — _(no submodules)_ - [float-utils](./src/utils/float-utils.md) — Float-bit-pattern conversion helpers used by the float packer and any consumer that needs to round-trip a `number` thro… - [pack-bits](./src/utils/pack-bits.md) — **Path:** `bitpacker/src/utils/pack-bits.ts` **Export:** See source for details. - [schema-validators](./src/utils/schema-validators.md) — Per-shape schema validation helpers used internally by `@suaveplan/bitpacker`'s legacy validator surface. Each function… - [type-guards](./src/utils/type-guards.md) — Generic type-guard helpers used across `@suaveplan/bitpacker` for safe narrowing of `unknown` values into well-typed sh… - [utils](./src/utils/utils.md) — _(no submodules)_ - [zigzag](./src/utils/zigzag.md) — **Path:** `bitpacker/src/utils/zigzag.ts` **Export:** See source for details. - [bit-schema](./src/bit-schema.md) — **Path:** `src/bit-schema.ts` **Export:** `defineBitSchema` (function) - [error-codes](./src/error-codes.md) — **Path:** `bitpacker/src/error-codes.ts` **Export:** See source for details. - [index](./src/index.md) — **Path:** `bitpacker/src/index.ts` **Export:** See source for details. - [register-schemas](./src/register-schemas.md) — Idempotent integration with `@suaveplan/schema-registry` for the core `@suaveplan/bitpacker` package. Exposes a single… - [types](./src/types.md) — **Path:** `src/types.ts` **Export:** Schema type guards, `BitPackerSchema` union, token types - [types.schema](./src/types.schema.md) — Zod schemas for the recursive `BitPackerSchema` union and every variant it can take. These schemas are the single sourc… ## Install ```bash bun add @suaveplan/bitpacker ``` ## Quick Start ```typescript import { BitPacker, registerDefaultStrategies } from "@suaveplan/bitpacker"; import { registerDefaultStrategies } from "@suaveplan/bitpacker-strategies"; const bp = new BitPacker(); registerDefaultStrategies(bp.strategyManager); const schema = { x: 255, y: "-16", active: true }; const packed = bp.pack({ x: 100, y: "hello", active: false }, schema); const unpacked = bp.unpack(packed, schema); ``` ## Modules - `src/bit-writer/bit-writer.ts` — Bit-level writer with `writeUint`, `writeInt`, `writeBool`, `writeFixed`, `writeBytes` - `src/bit-reader/bit-reader.ts` — Bit-level reader with `readUint`, `readInt`, `readBool`, `readFixed`, `readBytes`, `peek`, `seek` - `src/core/bitpacker.ts` — Schema-driven packer/unpacker with strategy manager and schema registry - `src/core/strategies/manager.ts` — `PackingStrategyManager`: chain-of-responsibility strategy resolution - `src/core/strategies/types.ts` — `PackingStrategy` and `PackingContext` interfaces - `src/core/strategies/invalid.ts` — Catch-all strategy for unknown schemas - `src/types.ts` — Schema type system: `BitPackerSchema`, guards, and token types - `src/bit-schema.ts` — Legacy `defineBitSchema` for fixed-field definitions - `src/utils/zigzag.ts` — Zigzag encoding for signed integers - `src/utils/pack-bits.ts` — Batch bit packing/unpacking utilities - `src/error-codes.ts` — Structured error codes and `BitpackerError`