Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 639 Bytes

README.md

File metadata and controls

31 lines (21 loc) · 639 Bytes

get-media-duration

Install

pnpm add get-media-duration

Usage

import { getDuration, getDurationInMinutes } from 'get-media-duration'

getDuration('./audio.mp3')
  .then(duration => console.log(duration))
  .catch(console.log)


getDuration('https://samplelib.com/lib/preview/mp3/sample-3s.mp3')
  .then(duration => console.log(duration))
  .catch(console.log)

getDurationInMinutes('./audio.mp3')
  .then(duration => console.log(duration))
  .catch(console.log)


getDurationInMinutes('https://samplelib.com/lib/preview/mp3/sample-3s.mp3')
  .then(duration => console.log(duration))
  .catch(console.log)