
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
b3dm is a TypeScript library for building and parsing B3DM format files. B3DM is a tile format in Cesium 3D Tiles, used to store 3D model data with Batch Tables and Feature Tables.
Install via npm:
npm install b3dm
import { buildB3dm } from 'b3dm';
// Input GLB data and metadata
const glbData = new Uint8Array([...]); // Binary GLB data
const featureTableJSON = { BATCH_LENGTH: 10 };
const batchTableJSON = { name: 'Building A', height: 50 };
// Build the B3DM file
const b3dmBuffer = buildB3dm({
glbData,
featureTableJSON,
batchTableJSON,
});
// Save the result as a file
require('fs').writeFileSync('output.b3dm', Buffer.from(b3dmBuffer));
import { parseB3dm } from 'b3dm';
// Read the B3DM file
const b3dmData = require('fs').readFileSync('example.b3dm');
const parsedData = parseB3dm(b3dmData.buffer);
console.log('Header:', parsedData.header);
console.log('Feature Table JSON:', parsedData.featureTable.json);
console.log('Batch Table JSON:', parsedData.batchTable?.json);
console.log('GLB Data Length:', parsedData.glbData.byteLength);
buildB3dm(options: B3dmBuildOptions): ArrayBufferoptions: Build options
Uint8Array).ArrayBuffer).parseB3dm(arrayBuffer: ArrayBuffer): B3dmDataarrayBuffer: The binary data of the B3DM file (ArrayBuffer).Uint8Array).The following are the main interface definitions in the library:
/** B3DM Header Structure */
export interface B3dmHeader {
magic: string; // Fixed as "b3dm"
version: number; // Version number (usually 1)
byteLength: number; // Total file length
featureTableJSONByteLength: number; // Length of Feature Table JSON
featureTableBinaryByteLength: number; // Length of Feature Table binary
batchTableJSONByteLength: number; // Length of Batch Table JSON
batchTableBinaryByteLength: number; // Length of Batch Table binary
}
/** Complete B3DM Data Structure */
export interface B3dmData {
header: B3dmHeader;
featureTable: {
json: Record<string, any>;
binary?: Uint8Array;
};
batchTable?: {
json: Record<string, any>;
binary?: Uint8Array;
};
glbData: Uint8Array; // Embedded GLB model data
}
/** Options for Building B3DM */
export interface B3dmBuildOptions {
glbData: Uint8Array; // Input GLB binary data
featureTableJSON?: Record<string, any>; // Feature Table JSON
featureTableBinary?: Uint8Array; // Feature Table binary
batchTableJSON?: Record<string, any>; // Batch Table JSON
batchTableBinary?: Uint8Array; // Batch Table binary
}
Contributions to b3dm are welcome! Here are some guidelines for contributing:
git clone https://github.com/cesiumjs/b3dm.gitnpm installnpm testnpm run build to ensure the code builds successfully.b3dm is released under the MIT License.
We hope this library helps you work with B3DM files more easily! If you have any questions, feel free to contact us.
FAQs
A TypeScript library for parsing and building B3DM (Batched 3D Model) files
We found that cmpt 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.