Node.js native binding to libogg. Updated to fix building in Node 12.
npm install @suldashi/oggnode-ogg
========
ogg files, and a
ogg files. libogg only provides the interfaces
node-ogg-compatible stream module, like node-vorbis and node-theora.
node-ogg comes bundled with its own copy of libogg, so
node-ogg using npm:
bash
$ npm install ogg
`
__NOTE:__ node-ogg requires to be built using node-gyp v0.8.0 or newer!
Example
-------
Here's an example of using the Decoder class and simply listening for the raw
events and console.log()s information about each "packet" emitted from each ogg
stream:
` javascript
var fs = require('fs');
var ogg = require('ogg');
var file = __dirname + '/Hydrate-Kenny_Beltrey.ogg';
var decoder = new ogg.Decoder();
decoder.on('stream', function (stream) {
console.log('new "stream":', stream.serialno);
// emitted for each ogg_packet instance in the stream.
stream.on('data', function (packet) {
console.log('got "packet":', packet.packetno);
});
// emitted after the last packet of the stream
stream.on('end', function () {
console.log('got "end":', stream.serialno);
});
});
// pipe the ogg file to the Decoder
fs.createReadStream(file).pipe(decoder);
`
See the examples directory for some more example code.
API
---
$3
The 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 ogg_packet Buffer
instances.encountered, which
you are then expected to pass along to a ogg stream decoder.
$3
The Encoder class is a Readable stream where you are given EncoderStream
instances and are required to write ogg_packets received from an ogg stream
encoder to them in order to create a valid ogg file.
OGG Stream Decoders/Encoders
----------------------------
Here's a list of known ogg stream decoders and encoders that are compatible with / depend on node-ogg.
Please send pull requests for additional modules if you write one.
| Module | Decoder? | Encoder?
|:--------------------------------:|:------------:|:------------:
| [node-vorbis][node-vorbis] | ✓ | ✓
| [node-opus`][node-opus] | ✓ | ✓