1.0.7 • Published 9 months ago

flac-tagger v1.0.7

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
9 months ago

flac-tagger

Pure JavaScript FLAC Tag writer and reader.

Installation

npm install flac-tagger

Usage

Read FLAC Tags

import { FlacTags, readFlacTags } from 'flac-tagger'
import { readFile } from 'fs/promises'

// read from file path
const tagsFromFile: FlacTags = await readFlacTags('path/to/file.flac')

// read from buffer
const buffer = await readFile('path/to/file.flac')
const tagsFromBuffer: FlacTags = await readFlacTags(buffer)

// read tag by vorbis comment name (case-insensitive)
const { title, artist, album } = tagsFromFile.tagMap
// read cover image
const coverBuffer = tagsFromFile.picture?.buffer

Write FLAC Tags

import { FlacTagMap, writeFlacTags } from 'flac-tagger'
import { readFile } from 'fs/promises'

// write vorbis comments (names are case-insensitive)
const tagMap: FlacTagMap = {
  // single value
  title: 'song title',
  // multiple values
  artist: ['artist A', 'artist B'],
  album: 'album name',
}
await writeFlacTags(
  {
    tagMap,
    // (optional) cover image
    picture: {
      buffer: await readFile('coverImage.jpg'),
    }
  },
  // path to existing flac file
  'path/to/file.flac',
)

Specification

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

10 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago