{"id":48894,"library":"peechy","title":"peechy","description":"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.","status":"active","version":"0.4.310","language":"javascript","source_language":"en","source_url":"https://github.com/jarred-sumner/peechy","tags":["javascript","typescript"],"install":[{"cmd":"npm install peechy","lang":"bash","label":"npm"},{"cmd":"yarn add peechy","lang":"bash","label":"yarn"},{"cmd":"pnpm add peechy","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only, named export. Function that takes a schema and data and returns a Buffer.","wrong":"const peechy = require('peechy'); peechy.encode(...)","symbol":"encode","correct":"import { encode } from 'peechy'"},{"note":"Named export, not default. Decodes binary data into JavaScript objects.","wrong":"import decode from 'peechy'","symbol":"decode","correct":"import { decode } from 'peechy'"},{"note":"The Schema class is exported from the main module. No subpath import needed.","wrong":"import { Schema } from 'peechy/schema'","symbol":"Schema","correct":"import { Schema } from 'peechy'"},{"note":"ESM-only; function to generate encoders/decoders from schema definitions.","wrong":"const generate = require('peechy').generate","symbol":"generate","correct":"import { generate } from 'peechy'"}],"quickstart":{"code":"import { Schema, encode, decode } from 'peechy';\n\n// Define a schema\nconst schema = new Schema({ name: 'string', age: 'uint8' });\n\n// Encode data\nconst person = { name: 'Alice', age: 30 };\nconst buffer = encode(schema, person);\n\n// Decode data\nconst decoded = decode(schema, buffer);\nconsole.log(decoded); // { name: 'Alice', age: 30 }","lang":"typescript","description":"Shows how to define a schema, encode a JavaScript object into binary, and decode it back."},"warnings":[{"fix":"Use Map or ensure object keys are in consistent order. Alternatively, use arrays of tuples.","message":"peechy schema fields are ordered: encoding order depends on property insertion order, which may not match object keys in all engines.","severity":"gotcha","affected_versions":">=0.1"},{"fix":"Re-encode data using the new library version. Cannot decode old buffers.","message":"Version 0.3 changed the binary format, breaking compatibility with buffers encoded by earlier versions.","severity":"breaking","affected_versions":">=0.3 <0.3.0"},{"fix":"Use 'string' instead of 'String' in schema definitions.","message":"The 'String' schema type is deprecated in favor of 'string' (lowercase).","severity":"deprecated","affected_versions":">=0.4"},{"fix":"Use optional fields with defaults: { name: 'string', age?: 'uint8' }.","message":"Empty objects or undefined values may not survive encode/decode cycle.","severity":"gotcha","affected_versions":">=0.4"},{"fix":"Use 'encode' and 'decode' with ArrayBuffer or direct Buffer handling.","message":"The 'encodeStream' and 'decodeStream' functions are deprecated and will be removed in v1.","severity":"deprecated","affected_versions":">=0.4 <1.0"}],"env_vars":null,"search_vec":"'0.4.310':31 'activ':33 'base':7 'binari':8,76 'browser':73 'buffer':37 'compact':24 'complex':27 'critic':81 'data':16 'definit':56 'design':19 'develop':34 'effici':12,60 'encod':13,25,43 'encoders/decoders':61 'environ':74 'flatbuff':39 'focus':41 'format':10 'generat':59 'high':21 'intend':69 'javascript':82 'javascript/typescript':50 'languag':57 'minim':46 'nativ':51 'nest':28 'node.js':71 'overhead':47 'packag':63 'peechi':1,2,40 'perform':22 'protocol':36 'schema':6,55 'schema-bas':5 'serial':9 'ship':64 'size':77 'speed':79 'structur':29 'support':49 'tree':14,44 'type':66 'typescript':65,83 'unlik':35 'use':53 'version':30","created_at":"2026-06-07T16:59:00.399975+00:00","updated_at":"2026-06-07T16:59:00.399975+00:00","problems":[{"fix":"npm install peechy","cause":"peechy is not installed or not in node_modules.","error":"Cannot find module 'peechy'"},{"fix":"Use import { encode } from 'peechy' instead of const peechy = require('peechy').","cause":"Using CommonJS require() instead of ESM import.","error":"TypeError: peechy.encode is not a function"},{"fix":"Change 'String' to 'string' in schema definition.","cause":"Using deprecated capital 'String' type; should be lowercase 'string'.","error":"Error: Unknown schema field type 'String'"},{"fix":"Check schema definition: { name: 'string', age: 'uint8' }.","cause":"Often caused by incorrect schema syntax, e.g., missing comma between fields.","error":"SyntaxError: Unexpected token, expected '}'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jarred-sumner/peechy#readme","github":"https://github.com/jarred-sumner/peechy","docs":null,"changelog":null,"pypi":null,"npm":"peechy","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}