📅  最后修改于: 2022-03-11 15:03:51.053000             🧑  作者: Mango
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);
});