Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

audio-cover

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

audio-cover

Get the cover from an audio file in the browser

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

audio-cover Build Status DEMO

Get the cover from an audio file in the browser

Installation

$ yarn add audio-cover

Demo

https://zzarcon.github.io/audio-cover

Usage

import getAudioCover from 'audio-cover';

try {
  const coverSrc = await getAudioCover(file);
  
  console.log('base64 encoded cover', coverSrc)
} catch (e) {
  console.log('no cover available', e)
}

Api

getAudioCover: (file: File) => Promise<string>

given a file, returns a promise with the cover in base64, otherwise will reject if cover is not present

Example

import getAudioCover from 'audio-cover';

class App extends React.Component {
  state = {}

  onChange = async (e) => {
    try {
      const file = e.target.files[0];
      const coverSrc = await getAudioCover(file);
      this.setState({coverSrc});
    } catch(e) {
      console.log('error:', e)
    }
  }

  render() {
    const {coverSrc} = this.state;

    return (
      <div>
        <input type="file" onChange={this.onChange}/>
        <img src={coverSrc} />
      </div>
    )
  }
}

Author 👶🏼

@zzarcon

FAQs

Package last updated on 24 Dec 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc