https://github.com/transitive-bullshit/get-mp3-duration
Computes the duration of an mp3 buffer in node or browser.
https://github.com/transitive-bullshit/get-mp3-duration
audio mp3
Last synced: about 1 month ago
JSON representation
Computes the duration of an mp3 buffer in node or browser.
- Host: GitHub
- URL: https://github.com/transitive-bullshit/get-mp3-duration
- Owner: transitive-bullshit
- Created: 2018-03-08T20:39:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T01:45:50.000Z (over 2 years ago)
- Last Synced: 2025-04-25T02:01:48.171Z (about 2 months ago)
- Topics: audio, mp3
- Language: JavaScript
- Size: 7.42 MB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# get-mp3-duration
> Computes the duration of an mp3 buffer in node or browser.
[](https://www.npmjs.com/package/get-mp3-duration) [](https://travis-ci.com/transitive-bullshit/get-mp3-duration) [](https://standardjs.com)
## Install
```bash
npm install --save get-mp3-duration
# or
yarn add get-mp3-duration
```## Usage
```js
const getMP3Duration = require('get-mp3-duration')
const buffer = fs.readFileSync('fixtures/vbr.mp3')
const duration = getMP3Duration(buffer)console.log(duration, 'ms') => 285727 ms
```## Related
- [mp3-duration](https://github.com/ddsol/mp3-duration) this package is a fork of mp3-duration to add browser support.
- [vmsg](https://github.com/Kagami/vmsg) is an optimized mp3 recorder for the web which ports the lame mp3 encoder to wasm.## License
MIT © [Travis Fischer](https://github.com/transitive-bullshit)
Support my OSS work by following me on twitter
![]()