NodeJS native binding to lieff/minimp3
This module hook into minimp3
, a "Minimalistic, single-header library for decoding MP3. minimp3
is designed to be small, fast (with SSE and NEON support), and accurate (ISO conformant)", to
provide a decode stream to NodeJS.
node-minimp3
is bundled with a copy of the library.
Installation via npm:
$ npm i minimp3
This is an example of how to decode an mp3-file and pipe the output to node-speaker
(TooTallNate/node-speaker)
const Decoder = require('minimp3')
const Speaker = require('speaker')
const { createReadStream } = require('fs')
const decoder = new Decoder()
const speaker = new Speaker()
const fileStream = createReadStream('/path/to/my/file.mp3')
fileStream.pipe(decoder).pipe(speaker)
The Decoder
class inherits Transform
from stream
and accepts mp3-data and outputs a decoded buffer.