New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

flac-stream-tagger

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flac-stream-tagger

Pure JavaScript FLAC Tag writer and reader.

latest
Source
npmnpm
Version
1.0.10
Version published
Maintainers
1
Created
Source

flac-stream-tagger

Pure JavaScript FLAC Tag writer and reader. Improved from flac-tagger to have native stream support and better memory handling for large files.

Installation

npm install flac-stream-tagger

Usage

Read

import { FlacStreamTagger } from "flac-stream-tagger";
import { createReadStream } from "fs";
import { readFile } from "fs/promises";

// Create read stream from file (can use any readable stream does not have to be a file)
const readStream = createReadStream("input.flac");

// Pipe any Readable stream into tagger
const tagger = readStream.pipe(new FlacStreamTagger());
// or from buffer
const tagger = FlacStreamTagger.fromBuffer(await readFile("input.flac"));

Print Tags

// Read tags
const tags = await tagger.tags();
console.log(tags);

// Read raw metadata blocks
const blocks = await tagger.metaBlocks();
console.log(blocks);

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

Write

import { FlacStreamTagger } from "flac-stream-tagger";
import { readFile } from "fs/promises";

const flacTags: FlacTags = {
	// write vorbis comments (names are case-insensitive)
	tagMap: {
		// single value
		title: "song title",
		// multiple values
		artist: ["artist A", "artist B"],
		album: "album name",
	},
	// (optional) cover image
	picture: {
		buffer: await readFile("coverImage.jpg"),
	},
};

// Some input stream see Read example
const inputStream: Readable;

// Pipe any Readable stream into tagger
const tagger = inputStream.pipe(new FlacStreamTagger(tags));
// or from buffer
const tagger = FlacStreamTagger.fromBuffer(inputBuffer, tags);

// Pipe tagger into any Writable stream
tagger.pipe(createWriteStream("output.flac"));
// or get the buffer
cosnt buffer = await tagger.toBuffer();

Specification

  • FLAC - Format
  • Ogg Vorbis Documentation

Keywords

nodejs

FAQs

Package last updated on 04 Apr 2025

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