Get the duration of an MP3 file
npm install mp3-duration> Calculate duration of an MP3
```
$ npm install --save mp3-duration
`javascript
var mp3Duration = require('mp3-duration');
mp3Duration('file.mp3', function (err, duration) {
if (err) return console.log(err.message);
console.log('Your file is ' + duration + ' seconds long');
});
`
Type: string | Buffer
Path to the file or a buffer with the file's contents
Defaults to false. When set to true, will estimate the length of a
constant-bitrate mp3. This speeds up the calculation a lot but isn't
guaranteed to be accurate.
Type: function
Callback to be called once duration is calculated. It's also possible to
instead use the returned Promise. duration is the duration of thems
mp3 in .
mp3Duration returns a Promise that resolves to the duration of the mp3 in ms` or rejects with some error.
MIT © Han de Boer