Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get audio duration node js

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);
});
Source by www.npmjs.com #
 
PREVIOUS NEXT
Tagged: #audio #duration #node #js
ADD COMMENT
Topic
Name
3+6 =