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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@missingcore/audio-metadata

v1.3.0

Published

An audio file metadata reader built for React Native.

Downloads

21

Readme

@missingcore/audio-metadata

NPM Version License

An audio file metadata reader built primarily for React Native (mobile only) supporting tags used in MissingCore/Music.

[!NOTE]
Supports React Native's "New Architecture".

Also works in a plain Node.js environment.

Supported Files

| Extension | Format | Additional Information | | ------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------- | | .flac | - FLAC | | | .mp3 | - ID3v1- ID3v2 | - Unsynchronisation supported*- Tag at end of file supported (ID3v2.4)*- All other flags ignored | | .mp4/.m4a | - MP-4 Part 14 (a.k.a. MP4) | |

* Currently untested as I have no .mp3 files that meets those conditions. Feel free to submit an issue to tell me if it works or doesn't work.

Installation

React Native

[!IMPORTANT]
Currently, this library only supports React Native 0.74.0 or Expo SDK 51 and newer due to the introduction of native atob() & btoa() support.

In the future, we may support older versions with a peer dependency of base-64.

This library supports using either expo-file-system or @dr.pogodin/react-native-fs (a more actively maintained fork of react-native-fs).

Note: Using @dr.pogodin/react-native-fs with expo requires a bare workflow.

Regardless of which file system library you use, they perform relatively the same.

With expo-file-system

npx expo install @missingcore/audio-metadata expo-file-system

With @dr.pogodin/react-native-fs

npm install @missingcore/audio-metadata @dr.pogodin/react-native-fs

Node.js

This library supports Node.js as it supplements the file system operations by using native Node.js modules.

Usage

import { getAudioMetadata } from '@missingcore/audio-metadata';

const uri = 'file:///storage/emulated/0/Music/Silence.mp3';
const wantedTags = ['album', 'albumArtist', 'artist', 'name', 'track', 'year'] as const;

// Of course with `await`, use this inside an async function or use `Promise.then()`.
const data = await getAudioMetadata(uri, wantedTags);
/*
  Returns:
    {
      fileType: 'mp3',
      format: 'ID3v2.3',
      metadata: {
          album: 'Void';
          albumArtist: 'Nothing';
          artist: 'Nothing';
          name: 'Silence';
          track: 1;
          year: 2024;
      }
    }
*/

Supported Tags

The full list of supported tags found here.

type AudioMetadata = {
  album: string;
  albumArtist: string;
  artist: string;
  artwork: string; // A base64 image string.
  name: string;
  track: number;
  year: number;
};

❗Note❗ that not all of the requested metadata may be present in the file read. In the returned metadata value, all the fields we want are "optional" (ie: its value can be undefined).

Related

License

MIT