
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@hdml/buffer
Advanced tools
This module is part of the **HDML-Utilities** monorepo and provides a set of utility functions to serialize and deserialize key components of the **HDML** (HyperData Markup Language) document model into and from FlatBuffers binary format. It enables effic
This module is part of the HDML-Utilities monorepo and provides a set of utility functions to serialize and deserialize key components of the HDML (HyperData Markup Language) document model into and from FlatBuffers binary format. It enables efficient data transmission and storage of complex hierarchical structures such as fields, models, filter clauses, frames, connections, and full HDML documents.
This package provides the following main functions:
HDOM object into a FlatBuffers binary format.HDOM object.StructType parameter (defaults to HDOMStruct).Additionally, the package provides lower-level conversion functions organized into two directories:
bufferify/: Functions that convert TypeScript objects from @hdml/types to FlatBuffers structs:
bufferifyHDOM: Converts HDOM to HDOMStructbufferifyConnection: Converts Connection to ConnectionStructbufferifyModel: Converts Model to ModelStructbufferifyFrame: Converts Frame to FrameStructbufferifyField: Converts Field to FieldStructbufferifyFilterClause: Converts FilterClause to FilterClauseStructobjectify/: Functions that convert FlatBuffers structs back to TypeScript objects:
objectifyHDOM: Converts HDOMStruct to HDOMobjectifyConnection: Converts ConnectionStruct to ConnectionobjectifyModel: Converts ModelStruct to ModelobjectifyFrame: Converts FrameStruct to FrameobjectifyField: Converts FieldStruct to FieldobjectifyFilterClause: Converts FilterClauseStruct to FilterClauseAdditionally, the package exports:
HDOMStruct, ConnectionStruct, ModelStruct, FrameStruct for specifying which struct type to structurize.This module depends on the @hdml/schemas package, which distributes FlatBuffers schema-based classes for serialization, and @hdml/types package that distributes TypeScript interface definitions for HDML components.
To install this module, simply add it to your project:
npm install @hdml/buffer
Here's a basic example of how to use the serialize and deserialize functions:
import { HDOM } from "@hdml/types";
import { serialize, deserialize } from "@hdml/buffer";
const hdom: HDOM = { ... }; // Your HyperData Document
// Serialize to binary format
const bytes = serialize(hdom);
// Transmit or store the binary.
// Deserialize back to HDOM object
const deserialized = deserialize(bytes);
// deserialized is now equal to the original hdom
If you need to work directly with FlatBuffers structs:
import { HDOM } from "@hdml/types";
import { serialize, structurize, StructType, objectifyHDOM } from "@hdml/buffer";
import { HDOMStruct, ConnectionStruct, ModelStruct, FrameStruct } from "@hdml/schemas";
const hdom: HDOM = { ... };
// Serialize to binary
const bytes = serialize(hdom);
// Convert to HDOM FlatBuffers struct (default)
const hdomStruct = structurize(bytes, StructType.HDOMStruct) as HDOMStruct;
// Or simply: structurize(bytes) - defaults to HDOMStruct
// Convert to other struct types (when working with individual buffers)
const connBytes: Uint8Array = ...; // Individual connection buffer
const connStruct = structurize(connBytes, StructType.ConnectionStruct) as ConnectionStruct;
const modelBytes: Uint8Array = ...; // Individual model buffer
const modelStruct = structurize(modelBytes, StructType.ModelStruct) as ModelStruct;
const frameBytes: Uint8Array = ...; // Individual frame buffer
const frameStruct = structurize(frameBytes, StructType.FrameStruct) as FrameStruct;
// Convert back to HDOM object
const hdomFromStruct = objectifyHDOM(hdomStruct);
The package ensures that serialization and deserialization are perfect inverses:
import { HDOM } from "@hdml/types";
import { serialize, deserialize } from "@hdml/buffer";
const original: HDOM = { ... };
const bytes = serialize(original);
const restored = deserialize(bytes);
// restored is deeply equal to original
console.assert(JSON.stringify(restored) === JSON.stringify(original));
The fileifize function allows you to split a complete HDOM buffer into separate buffers for each connection, model, and frame:
import { serialize, fileifize } from "@hdml/buffer";
const hdom: HDOM = { ... };
const hdomBuffer = serialize(hdom);
// Split into individual file buffers
const result = fileifize(hdomBuffer);
// result.connections: Array<{ name: string; buffer: Uint8Array }>
// result.models: Array<{ name: string; buffer: Uint8Array }>
// result.frames: Array<{ name: string; buffer: Uint8Array }>
// Each buffer can be stored or transmitted independently
result.connections.forEach((conn) => {
// Store conn.buffer as a file named conn.name
});
Apache License Version 2.0
FAQs
This module is part of the **HDML-Utilities** monorepo and provides a set of utility functions to serialize and deserialize key components of the **HDML** (HyperData Markup Language) document model into and from FlatBuffers binary format. It enables effic
We found that @hdml/buffer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.