A modern JavaScript implementation of RFC8794 (EBML).
EBML stands for Extensible Binary Meta-Language and is somewhat of a binary version of XML. It's used for container formats like WebM or MKV.
This package is serving as a fork with extensive rewrites and enhancements to ebml-web-stream and ebml-stream, providing:
- support new ebml_matroska(v4) while also support legacy version.
- better unknown size vint support
- bigint support for vint, unsigned and signed int data type
- better type system and type hints that depend on it
- better error types
Install via NPM:
npm install konoebml
This example reads a media file into memory and decodes it.
import fs from 'node:fs/promises';
import {
ReadableStream,
WritableStream,
type TransformStream,
} from 'node:stream/web';
import { EbmlStreamDecoder } from 'konoebml';
async function main() {
const fileBuffer = await fs.readFile('media/test.webm');
await new ReadableStream({
pull(controller) {
controller.enqueue(fileBuffer);
controller.close();
},
})
.pipeThrough(new EbmlStreamDecoder() as unknown as TransformStream)
.pipeTo(new WritableStream({ write: console.log }));
}
main();
Todo: add more docs and tests
Parsing and writing should both work. If something is broken, please create an issue.
Any additional feature requests can also be submitted as an issue.
If any well-known tags have special parsing/encoding rules or data structures that aren't implemented, pull requests are welcome!
(in alphabetical order)