Node.js native binding to libogg
This module provides a Writable stream interface for decoding
ogg files, and a
Readable stream for encoding
libogg only provides the interfaces
for multiplexing the various streams embedding into an ogg file (and vice versa),
therefore this module is intended to be used in conjunction with a
node-ogg-compatible stream module, like
node-ogg comes bundled with its own copy of
there's no need to have the library pre-installed on your system.
Simply compile and install
$ npm install ogg
node-ogg requires to be built using
node-gyp v0.8.0 or newer!
Here's an example of using the
Decoder class and simply listening for the raw
console.log()s information about each "packet" emitted from each ogg
var fs = require'fs';var ogg = require'ogg';var file = __dirname + '/Hydrate-Kenny_Beltrey.ogg';var decoder = ;decoderon'stream'console.log'new "stream":' streamserialno;// emitted for each `ogg_packet` instance in the stream.streamon'data'console.log'got "packet":' packetpacketno;;// emitted after the last packet of the streamstreamon'end'console.log'got "end":' streamserialno;;;// pipe the ogg file to the DecoderfscreateReadStreamfilepipedecoder;
examples directory for some more example code.
Decoder class is a
Writable stream that accepts an ogg file written to
it, and emits "stream" events when a new stream is encountered. The
DecoderStream instance is a readable stream that outputs
you are then expected to pass along to a ogg stream decoder.
Encoder class is a
Readable stream where you are given
instances and are required to write
ogg_packets received from an ogg stream
encoder to them in order to create a valid ogg file.
Here's a list of known ogg stream decoders and encoders that are compatible with / depend on
Please send pull requests for additional modules if you write one.