Registry / storage / peechy

peechy

JSON →
library0.4.310jsnpmunverified

peechy is a schema-based binary serialization format for efficiently encoding trees of data. It is designed for high performance and compact encoding of complex nested structures. Version 0.4.310 is actively developed. Unlike Protocol Buffers or FlatBuffers, peechy focuses on encoding trees with minimal overhead and supports JavaScript/TypeScript natively. It uses a schema definition language and generates efficient encoders/decoders. The package ships TypeScript types and is intended for Node.js and browser environments where binary size and speed are critical.

npm install peechy
INSTALL
IMPORT
SIG · PEECHY
P
peechy
storagejavascriptv0.4.310
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

encode
✓ import { encode } from 'peechy'
✗ const peechy = require('peechy'); peechy.encode(...)
ESM-only, named export. Function that takes a schema and data and returns a Buffer.
decode
✓ import { decode } from 'peechy'
✗ import decode from 'peechy'
Named export, not default. Decodes binary data into JavaScript objects.
Schema
✓ import { Schema } from 'peechy'
✗ import { Schema } from 'peechy/schema'
The Schema class is exported from the main module. No subpath import needed.
generate
✓ import { generate } from 'peechy'
✗ const generate = require('peechy').generate
ESM-only; function to generate encoders/decoders from schema definitions.

Shows how to define a schema, encode a JavaScript object into binary, and decode it back.

import { Schema, encode, decode } from 'peechy'; // Define a schema const schema = new Schema({ name: 'string', age: 'uint8' }); // Encode data const person = { name: 'Alice', age: 30 }; const buffer = encode(schema, person); // Decode data const decoded = decode(schema, buffer); console.log(decoded); // { name: 'Alice', age: 30 }
Debug
Known issues
gotchapeechy schema fields are ordered: encoding order depends on property insertion order, which may not match object keys in all engines.
fix
Use Map or ensure object keys are in consistent order. Alternatively, use arrays of tuples.
affects: >=0.1
breakingVersion 0.3 changed the binary format, breaking compatibility with buffers encoded by earlier versions.
fix
Re-encode data using the new library version. Cannot decode old buffers.
affects: >=0.3 <0.3.0
deprecatedThe 'String' schema type is deprecated in favor of 'string' (lowercase).
fix
Use 'string' instead of 'String' in schema definitions.
affects: >=0.4
gotchaEmpty objects or undefined values may not survive encode/decode cycle.
fix
Use optional fields with defaults: { name: 'string', age?: 'uint8' }.
affects: >=0.4
deprecatedThe 'encodeStream' and 'decodeStream' functions are deprecated and will be removed in v1.
fix
Use 'encode' and 'decode' with ArrayBuffer or direct Buffer handling.
affects: >=0.4 <1.0
Errors
Common errors & fixes
Cannot find module 'peechy'
peechy is not installed or not in node_modules.
fix
npm install peechy
TypeError: peechy.encode is not a function
Using CommonJS require() instead of ESM import.
fix
Use import { encode } from 'peechy' instead of const peechy = require('peechy').
Error: Unknown schema field type 'String'
Using deprecated capital 'String' type; should be lowercase 'string'.
fix
Change 'String' to 'string' in schema definition.
SyntaxError: Unexpected token, expected '}'
Often caused by incorrect schema syntax, e.g., missing comma between fields.
fix
Check schema definition: { name: 'string', age: 'uint8' }.
Upgrade
Version history
0.4.310latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
packagepeechy ↗
peechy — npm install peechy · libregistry