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

tagtoname

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tagtoname

Renames audio files using the metadata tags

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

tagtoname

build status npm version

Renames audio files using the metadata tags

Installing

npm install tagtoname

CLI

Usage: tagtoname [-k] [-n] [-s separator] [-t tag]... file...

Renames audio files using the metadata tags.

Options:

  -k, --keep-case            Keep the original case of the tags when renaming
  -n, --noop                 Dry run, show new paths without renaming the files
  -s, --separator=SEPARATOR  Split tags with SEPARATOR;
                             defaults to -s-
  -t, --tag=TAG              Append TAG(s) to the new name;
                             defaults to -t artist -t title
  --help                     Show help
  --version                  Output the version number

For example, by default a file with the "mp3" ext, the artist tag "Beethoven",
and the title tag "Ode to Joy" is renamed to "beethoven-ode-to-joy.mp3".

See the list of supported tags (the -t option accepts any value from the "Common tag" column).

Examples

# Rename a file.
# For example, if the file has the "artist" tag "Beethoven", and the "title" tag
# "Ode to Joy", by default it will be renamed to "beethoven-ode-to-joy.mp3".
tagtoname file.mp3

# Rename all files in a folder.
tagtoname folder/*
# Rename a file and keep the original case of the tags instead of lowercasing.
# For example, if the file has the "artist" tag "Philip Glass", and the "title"
# tag "Opening", it will be renamed to "Philip-Glass-Opening.mp3".
tagtoname -k file.mp3

# Dry run, output what would happen if we were to rename all files in a folder.
tagtoname -n folder/*

# Rename a file using a custom separator.
# For example, if the file has the "artist" tag "Debussy", and the "title" tag
# "Reverie", it will be renamed to "debussy_reverie.mp3".
tagtoname -s _ file.mp3

# Rename a file using specific tags.
# For example, if the file has the "title" tag "A Clockwork Orange", and the
# "year" tag "1971", it will be renamed to "a-clockwork-orange-1971.mp4".
tagtoname -t title -t year file.mp4

API

tagtoname(paths, options)

Renames audio files using the metadata tags.

The first argument is an array of paths to the files to be renamed.

The second argument is an options object with the following properties:

  • keepCase: Keep the original case of the tags when renaming, defaults to false
  • noop: Whether to perform a dry run and not rename files, defaults to false
  • separator: The separator used to split the tags in the name, defaults to "-"
  • tags: An array of tags to use in the new name of the file, defaults to ["artist", "title"]

Returns an EventEmmiter object with the following events:

  • "success", emitted when the new path is different from the old path, passing the new path (string) to the callback
  • "abort", emitted when the new path is the same as the old path, passing the old path (string) to the callback
  • "error", emitted when a file cannot be renamed, passing the Error object to the callback
  • "complete", emitted when all files have been processed

Examples

import tagtoname from "tagtoname";

// Rename files using the "title" and "year" tags
tagtoname(["file1.mp4", "file2.mp4"], { tags: ["title", "year"] })
  .on("success", newPath => console.log(newPath))
  .on("abort", oldPath => console.log(`${oldPath} (unchanged)`))
  .on("error", error => console.error(error.message));

License

MIT

Keywords

FAQs

Package last updated on 15 May 2020

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