Socket
Socket
Sign inDemoInstall

mp3-duration

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mp3-duration

Get the duration of an MP3 file


Version published
Weekly downloads
3.9K
increased by16.4%
Maintainers
1
Weekly downloads
 
Created
Source

mp3-duration Travis-Build

Calculate duration of an MP3

Install

$ npm install --save mp3-duration

Usage

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');
});

API

mp3Duration(filePathOrBuffer [, cbrEstimate] [, callback])

filePathOrBuffer

Type: string | Buffer

Path to the file or a buffer with the file's contents

cbrEstimate

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.

callback(error, duration)

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 the mp3 in ms.

Return value

mp3Duration returns a Promise that resolves to the duration of the mp3 in ms or rejects with some error.

License

MIT © Han de Boer

Keywords

FAQs

Package last updated on 16 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc