Socket
Socket
Sign inDemoInstall

convert-audio

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    convert-audio

A lightweight audio conversion tool to convert mp3, wav and aac file.


Version published
Weekly downloads
126
increased by7.69%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

convert-audio

A lightweight audio conversion tool to convert mp3, wav and aac file.

DEMO

Install
npm install convert-audio

Usage

import AudioConverter from 'convert-audio'

AudioConverter.convert(sourceAudioFile, targetAudioFormat);

Example Code

<input type='file' accept=".mp3, .wav, .aac" onchange="convertAudio(this)" />

import AudioConverter from 'convert-audio'

async function convertAudio(input) {
    let sourceAudioFile = input.files[0];
    let targetAudioFormat = 'wav'
    let convertedAudioDataObj = await AudioConverter.convert(sourceAudioFile, targetAudioFormat);
}
This convert function will return a converted audio data object which includes audio name, format and blob URL.
This blob URL can be used to download the converted audio.
function downloadAudio(convertedAudioDataObj) {
    let a = document.createElement("a");
    a.href = convertedAudioDataObj.data;
    a.download = convertedAudioDataObj.name + "." + convertedAudioDataObj.format;
    a.click();
}

License

MIT

Keywords

FAQs

Last updated on 27 Apr 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc