Obtenha o nó de duração do áudio JS
$ npm install --save get-audio-duration
Breakable Bat
$ npm install --save get-audio-duration
const { getAudioDurationInSeconds } = require('get-audio-duration');
// From a local path...
getAudioDurationInSeconds('audio.flac').then((duration) => {
console.log(duration);
});
// From a readable stream...
const fs = require('fs');
const stream = fs.createReadStream('audio.flac');
getAudioDurationInSeconds(stream).then((duration) => {
console.log(duration);
});