npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bitnet-infotech/react-native-wav-to-mp3

v2.0.8

Published

A React Native library for converting WAV files to MP3 format using LAME encoder

Downloads

60

Readme

@bitnet-infotech/react-native-wav-to-mp3

A React Native library for converting WAV audio files to MP3 format using the LAME encoder. This library provides native implementations for both iOS and Android platforms.

Features

  • Convert WAV files to MP3 format
  • Progress tracking during conversion
  • Configurable bitrate and quality settings
  • Support for both iOS and Android platforms

Installation

npm install @bitnet-infotech/react-native-wav-to-mp3
# or
yarn add @bitnet-infotech/react-native-wav-to-mp3

iOS Setup

Run pod install in your iOS directory:

cd ios && pod install

Android Setup

The Android implementation includes the LAME encoder, so no additional setup is required.

Usage

import wavToMp3 from '@bitnet-infotech/react-native-wav-to-mp3';

const convertAudio = async () => {
  try {
    const wavPath = 'file:///path/to/your/audio.wav';
    const mp3Path = 'file:///path/to/output/audio.mp3';
    
    // Add progress listener
    const subscription = wavToMp3.events.addProgressListener((progress) => {
      console.log(`Converting: ${(progress.progress * 100).toFixed(1)}%`);
    });

    const result = await wavToMp3.convert(wavPath, mp3Path, {
      bitrate: 192,  // 192kbps
      quality: 2     // High quality
    });
    
    console.log('Conversion successful:', result);
    
    // Clean up listener
    subscription.remove();
  } catch (error) {
    console.error('Conversion failed:', error);
  }
};

API Reference

Methods

convert(inputPath: string, outputPath: string, options?: WavToMp3Options): Promise<string>

Converts a WAV file to MP3 format using the LAME encoder.

Parameters
  • inputPath (string): The file path to the source WAV file

    • Must be a valid file URL (starting with 'file:///')
    • Example: 'file:///path/to/audio.wav'
  • outputPath (string): The file path where the converted MP3 should be saved

    • Must be a valid file URL (starting with 'file:///')
    • Example: 'file:///path/to/output.mp3'
  • options (WavToMp3Options, optional): Conversion settings

    interface WavToMp3Options {
      /**
       * MP3 encoding bitrate in kbps
       * @default 128
       */
      bitrate?: number;
        
      /**
       * Encoding quality (0=best, 9=worst)
       * @default 5
       */
      quality?: number;
    }
Returns
  • Promise<string>: Resolves with the path to the converted MP3 file
  • Rejects with an error if the conversion fails

Events

Progress Tracking

interface ConversionProgress {
  /**
   * Progress value between 0 and 1
   */
  progress: number;
}

To track conversion progress:

const subscription = wavToMp3.events.addProgressListener((progress) => {
  console.log(`Progress: ${(progress.progress * 100).toFixed(1)}%`);
});

// Don't forget to remove the listener when done
subscription.remove();

Error Handling

The conversion might fail for several reasons:

  • Invalid input/output file paths
  • Input file doesn't exist
  • Input file is not a valid WAV file
  • Insufficient permissions
  • Device storage is full

Example

import wavToMp3 from '@bitnet-infotech/react-native-wav-to-mp3';
import RNFS from 'react-native-fs';

const convertWavToMp3Example = async () => {
  try {
    // Example paths - adjust according to your app's needs
    const wavPath = `${RNFS.DocumentDirectoryPath}/input.wav`;
    const mp3Path = `${RNFS.DocumentDirectoryPath}/output.mp3`;
    
    // Add progress listener
    const subscription = wavToMp3.events.addProgressListener((progress) => {
      console.log(`Converting: ${(progress.progress * 100).toFixed(1)}%`);
    });
    
    const result = await wavToMp3.convert(
      `file://${wavPath}`,
      `file://${mp3Path}`,
      {
        bitrate: 192,  // Higher quality audio
        quality: 2     // Better encoding quality
      }
    );
    
    console.log('MP3 file saved at:', result);
    
    // Clean up
    subscription.remove();
  } catch (error) {
    console.error('Conversion error:', error);
  }
};

Requirements

  • React Native >= 0.60.0
  • iOS 11.0 or later
  • Android API level 21 (Android 5.0) or later

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © BITNET-Infotech

Support

For bugs, feature requests, or questions, please file an issue.