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

music-tag

v0.0.9

Published

ID3 reader and writer for NodeJS

Downloads

20

Readme

music-tag

Build Status Test Coverage Code Climate Dependency Status

ID3 reader and writer for NodeJS

Usage

id3.read(path, [opts])

The read method returns a promise for a ReadResult or an array of ReadResult of the path requested. The path parameter is a String with the path (relative or absolute) of a file or folder. The optional opts parameter is an object with the following properties:

  • recursive: Read recursively when the path parameter is a folder path. ( Boolean. Default: true )
  • each: A function to be called for each result ( Function (ReadResult). Default: null )

For example:

var id3 = require('music-tag');

id3.read('music.mp3').then(function(result) {
	console.log(result.data);
}).fail(function(err) {
	throw err;
});

id3.write(path, tags, [opts])

The write method returns a promise for a WriteResult or an array of WriteResult of the path requested. The path parameter is a String with the path (relative or absolute) of a file or folder. The tags parameter is an object with the new tags to add to the path. The optional opts parameter is an object with the following properties:

  • recursive: Write recursively when the path parameter is a folder path. ( Boolean. Default: true )
  • each: A function to be called for each result ( Function (WriteResult). Default: null )
  • replace: Removes any previously existing tag. ( Boolean. Default: false )

For example:

var id3 = require('music-tag');

id3.write('music.mp3', { artist: 'Me' }).then(function(result) {
	console.log(result.tags);
}).fail(function(err) {
	throw err;
});

ReadResult

The ReadResult object contains the following properties:

  • path: Path of the read file ( String )
  • tags: The tags read ( Object )

WriteResult

The WriteResult object contains the following properties:

  • path: Path of the written file ( String )
  • tags: The tags written ( Object )

Development

Run the following command to install the development dependencies:

npm install

The project uses Gulp as build system. Run the following command to install gulp:

npm install -g gulp

The dev task provides a loop that runs JSHint and Mocha when a change is detected. Run the following command to start the task:

gulp dev