I use .pipe(new lame.Decoder), but not work
Closed this issue · 3 comments
klren0312 commented
let mp3Stream = fs.createReadStream(`./${req.file.path}`)
mp3Stream
.pipe(new lame.Decoder)
.pipe(fs.createWriteStream(path.resolve(__dirname, './sample_pcm.pcm')))
the sample_pcm.pcm is empty file
LinusU commented
I would recommend adding error handlers so that you can see what goes wrong, e.g. with the pump utility: https://github.com/mafintosh/pump
const mp3Stream = fs.createReadStream(`./${req.file.path}`)
const decoder = new lame.Decoder()
const output = fs.createWriteStream(path.resolve(__dirname, './sample_pcm.pcm'))
pump(mp3Stream, decoder, output, (err) => {
console.error(err.stack)
})
klren0312 commented
I use pump, but it has no err throw, is undefined..., but pcm file is also empty
klren0312 commented
I think my mp3 file has some problem