{"id":16849,"library":"matroska-schema","title":"Matroska and EBML Schema Definitions","description":"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`.","status":"maintenance","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/davedoesdev/matroska-schema","tags":["javascript"],"install":[{"cmd":"npm install matroska-schema","lang":"bash","label":"npm"},{"cmd":"yarn add matroska-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add matroska-schema","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports the entire schema object as its default export.","wrong":"import { matroskaSchema } from 'matroska-schema';","symbol":"matroskaSchema","correct":"import matroskaSchema from 'matroska-schema';"},{"note":"CommonJS require style for Node.js environments.","symbol":"matroskaSchema","correct":"const matroskaSchema = require('matroska-schema');"},{"note":"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.","symbol":"SchemaEntry","correct":"import matroskaSchema from 'matroska-schema';\nconst ebmlHeader = matroskaSchema.find(entry => entry.name === 'EBMLHeader');"}],"quickstart":{"code":"import matroskaSchema from 'matroska-schema';\n\nconsole.log('Successfully loaded Matroska schema. Total entries:', matroskaSchema.length);\n\n// Example: Find the 'Segment' top-level element definition\nconst segmentElement = matroskaSchema.find(entry => entry.name === 'Segment');\n\nif (segmentElement) {\n  console.log('Found Segment element:', segmentElement.name, 'ID:', segmentElement.id.toString(16));\n  console.log('Segment element description:', segmentElement.description.substring(0, 70) + '...');\n} else {\n  console.log('Segment element not found in schema.');\n}\n\n// To see a specific part of the schema, e.g., the EBML Header definition\nconst ebmlHeader = matroskaSchema.find(entry => entry.name === 'EBMLHeader');\nif (ebmlHeader) {\n    console.log('\\nEBMLHeader definition:');\n    console.dir(ebmlHeader, { depth: 2 });\n}","lang":"typescript","description":"Demonstrates how to import the Matroska schema and access a specific element definition within it."},"warnings":[{"fix":"Ensure `matroska-schema` is installed and imported, replacing any direct references to a GPL-licensed schema file.","message":"This 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Periodically review the Matroska and EBML specifications and test your parsing logic against newer versions of `matroska-schema`.","message":"The 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.","severity":"breaking","affected_versions":">=1.0.0"},{"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.","message":"As 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"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');`","cause":"Attempting to call `find` on an undefined or incorrectly imported schema object.","error":"TypeError: Cannot read properties of undefined (reading 'find')"},{"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.","cause":"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.","error":"ERR_REQUIRE_ESM: require() of ES Module ... matroska-schema/schema.js not supported."},{"fix":"Run `npm install matroska-schema` or `yarn add matroska-schema` in your project directory.","cause":"The package is not installed or not resolvable from the current working directory or `NODE_PATH`.","error":"Cannot find module 'matroska-schema'"}],"ecosystem":"npm","meta_description":null}