TooTallNate / node-lame

Node.js native bindings to libmp3lame & libmpg123
MIT License
567 stars 113 forks source link

Can I Browserify it? #39

Closed moirrer closed 9 years ago

moirrer commented 9 years ago

Any chance to make this work in my client side? Was tring browserify the PCM example

var fs = require('fs'); var lame = require('lame'); var path = require('path');

fs.createReadStream(process.argv[2] || path.resolve(dirname, 'sample.float.pcm')) .pipe(new lame.Encoder({ channels: 2, bitDepth: 32, float: true })) .pipe(fs.createWriteStream(path.resolve(dirname, 'sample_pcm.mp3'))) .on('close', function () { console.error('done!'); });

but keep getting error: fs.createReadStream is not a function

TooTallNate commented 9 years ago

No, unfortunately this is a native addon, so it won't work in the browser.

However, I have experimented in the past with compiling libmpg123 to JS using emscripten. This experiment isn't entirely complete, but you can see it here: https://github.com/TooTallNate/mpg123.js.

Cheers!