Registry / serialization / matroska-schema

matroska-schema

JSON →
library2.1.0jsnpmunverified

This package, `matroska-schema`, provides the official Matroska and EBML (Extensible Binary Meta Language) schema definitions for JavaScript environments. It serves as an MIT-licensed alternative to the previously GPL-licensed `schema.js` embedded within the `node-matroska` project, addressing licensing compatibility concerns for developers. The schema is automatically generated directly from the latest Matroska and EBML specifications maintained by the IETF-WG-CELLAR group, ensuring it remains current with the evolving standards for multimedia container formats. Currently at version 2.1.0, the package's release cadence is directly tied to updates in the upstream specifications, providing a reliable and permissively licensed data structure for libraries that parse, validate, or generate Matroska files, such as `node-matroska` or `node-ebml`.

npm install matroska-schema
INSTALL
IMPORT
SIG · MATROSKA-SCHEMA
M
matroska-schema
serializationjavascriptv2.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

matroskaSchema
import matroskaSchema from 'matroska-schema';
import { matroskaSchema } from 'matroska-schema';
The package exports the entire schema object as its default export.
matroskaSchema
const matroskaSchema = require('matroska-schema');
CommonJS require style for Node.js environments.
SchemaEntry
import matroskaSchema from 'matroska-schema'; const ebmlHeader = matroskaSchema.find(entry => entry.name === 'EBMLHeader');
The imported `matroskaSchema` is typically an array of schema entries, requiring iteration or filtering to find specific definitions. It's not a direct object lookup by name.

Demonstrates how to import the Matroska schema and access a specific element definition within it.

import matroskaSchema from 'matroska-schema'; console.log('Successfully loaded Matroska schema. Total entries:', matroskaSchema.length); // Example: Find the 'Segment' top-level element definition const segmentElement = matroskaSchema.find(entry => entry.name === 'Segment'); if (segmentElement) { console.log('Found Segment element:', segmentElement.name, 'ID:', segmentElement.id.toString(16)); console.log('Segment element description:', segmentElement.description.substring(0, 70) + '...'); } else { console.log('Segment element not found in schema.'); } // To see a specific part of the schema, e.g., the EBML Header definition const ebmlHeader = matroskaSchema.find(entry => entry.name === 'EBMLHeader'); if (ebmlHeader) { console.log('\nEBMLHeader definition:'); console.dir(ebmlHeader, { depth: 2 }); }
Debug
Known issues
gotchaThis package was created as an MIT-licensed alternative to a GPL-licensed schema. If migrating from older `node-matroska` versions, ensure you are using this package for broader license compatibility.
fix
Ensure `matroska-schema` is installed and imported, replacing any direct references to a GPL-licensed schema file.
affects: >=1.0.0
breakingThe schema is automatically generated from official Matroska and EBML specifications. While the package API remains stable, changes in the underlying specifications may alter the structure or available elements within the schema data itself. This could implicitly break parsers relying on a fixed schema structure.
fix
Periodically review the Matroska and EBML specifications and test your parsing logic against newer versions of `matroska-schema`.
affects: >=1.0.0
gotchaAs a data-only package, `matroska-schema` doesn't enforce strict ESM/CJS compatibility beyond what Node.js provides. While `require()` and `import` generally work, ensure your project's module resolution is correctly configured, especially in bundled environments.
fix
For CommonJS, use `const schema = require('matroska-schema');`. For ES Modules, use `import schema from 'matroska-schema';`. If encountering issues, check your `tsconfig.json` (for TypeScript) or build tool configuration.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'find')
Attempting to call `find` on an undefined or incorrectly imported schema object.
fix
Ensure `matroska-schema` is correctly installed (`npm install matroska-schema`) and imported as a default export: `import matroskaSchema from 'matroska-schema';` or `const matroskaSchema = require('matroska-schema');`
ERR_REQUIRE_ESM: require() of ES Module ... matroska-schema/schema.js not supported.
Attempting to `require()` the package in an environment configured for ES Modules where the package might be treated as ESM-only, or when the `package.json` specifies `"type": "module"` and a direct `require()` is used on a file that only exposes ESM.
fix
If your project is ES Modules-based, use `import matroskaSchema from 'matroska-schema';`. If using CommonJS, ensure your Node.js version supports interop, or check if an older version of `matroska-schema` (if applicable) is strictly CommonJS.
Cannot find module 'matroska-schema'
The package is not installed or not resolvable from the current working directory or `NODE_PATH`.
fix
Run `npm install matroska-schema` or `yarn add matroska-schema` in your project directory.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
matroska-schema — npm install matroska-schema · libregistry