# react-native-get-mp3-duration

> Computes the duration of an mp3 in react native.

Latest version **1.0.3** (published 2022-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-get-mp3-duration
pnpm add react-native-get-mp3-duration
yarn add react-native-get-mp3-duration
bun add react-native-get-mp3-duration
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-03-02 |
| First published | 2022-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Travis Fischer |
| Maintainers | kesymaru |
| Keywords | mp3, duration, audio, react-native |

## Links

- npm: https://www.npmjs.com/package/react-native-get-mp3-duration
- Repository: https://github.com/Kesymaru/react-native-get-mp3-duration
- Homepage: https://github.com/Kesymaru/react-native-get-mp3-duration#readme
- Issues: https://github.com/Kesymaru/react-native-get-mp3-duration/issues
- npm.io page: https://npm.io/package/react-native-get-mp3-duration

## Dependencies (1)

- [buffer](https://npm.io/package/buffer.md) ^6.0.3

## Recent versions

- 1.0.3 (latest) — 2022-03-02
- 1.0.2 — 2022-03-02
- 1.0.1 — 2022-03-02
- 1.0.0 — 2022-03-01

## README

# react-native-get-mp3-duration

> Computes the duration of an mp3 buffer in react native

[![NPM](https://img.shields.io/npm/v/get-mp3-duration.svg)](https://www.npmjs.com/package/get-mp3-duration) [![Build Status](https://travis-ci.com/transitive-bullshit/get-mp3-duration.svg?branch=master)](https://travis-ci.com/transitive-bullshit/get-mp3-duration) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save react-native-get-mp3-duration
# or
yarn add react-native-get-mp3-duration
```

## Usage

```typescript
import getMP3Duration from 'get-mp3-duration';
import {FileSystem} from 'react-native-file-access'; // or another lib that read the file into base64

const bufferStr = await FileSystem.readFile('fixtures/vbr.mp3', 'base64')
const duration = await getMP3Duration(bufferStr)

console.log(duration, 'ms') // 285727 ms
```

## Duration in seconds

```typescript
import getMP3Duration from 'get-mp3-duration';
import {FileSystem} from 'react-native-file-access'; // or another lib that read the file into base64

const bufferStr = await FileSystem.readFile('fixtures/vbr.mp3', 'base64')
const duration = await getMP3Duration(bufferStr, 'seconds')

console.log(duration, 'seconds') // 285.727 seconds
```

## 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 <a href="https://twitter.com/transitive_bs">following me on twitter <img src="https://storage.googleapis.com/saasify-assets/twitter-logo.svg" alt="twitter" height="24px" align="center"></a>

---
_Source: https://npm.io/package/react-native-get-mp3-duration · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
