
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
flac-metadata
Advanced tools
A FLAC metadata processor for Node.js, implemented as Transform stream.
npm install flac-metadata
Some simple examples to get you started:
Does nothing, just pipes a source FLAC through the Processor into a target FLAC.
var fs = require("fs");
var flac = require("flac-metadata");
var reader = fs.createReadStream("source.flac");
var writer = fs.createWriteStream("target.flac");
var processor = new flac.Processor();
reader.pipe(processor).pipe(writer);
Traces out the metadata from a FLAC file.
var fs = require("fs");
var flac = require("flac-metadata");
var reader = fs.createReadStream("source.flac");
var processor = new flac.Processor({ parseMetaDataBlocks: true });
processor.on("postprocess", function(mdb) {
console.log(mdb.toString());
});
reader.pipe(processor);
The output should be something like this:
[MetaDataBlockStreamInfo] type: 0, isLast: false
minBlockSize: 4096
maxBlockSize: 4096
minFrameSize: 14
maxFrameSize: 12389
samples: 9750804
sampleRate: 44100
channels: 2
bitsPerSample: 16
duration: 3:41.107
checksum: 1746dff27beb6d1875a88cfeed8a576b
[MetaDataBlockVorbisComment] type: 4, isLast: false
vendor: reference libFLAC 1.2.1 20070917
comments:
ALBUM: Close to the Glass
ARTIST: The Notwist
GENRE: Rock
DATE: 2014
TITLE: Signals
[MetaDataBlockPicture] type: 6, isLast: true
pictureType: 3
mimeType: image/png
description:
width: 120
height: 120
bitsPerPixel: 32
colors: 0
pictureData: 391383
Pipes a source FLAC through the Processor into a target FLAC, removing all metadata.
var fs = require("fs");
var flac = require("flac-metadata");
var reader = fs.createReadStream("source.flac");
var writer = fs.createWriteStream("target.flac");
var processor = new flac.Processor();
processor.on("preprocess", function(mdb) {
// STREAMINFO is always the first (and only mandatory) metadata block.
if (mdb.type === flac.Processor.MDB_TYPE_STREAMINFO) {
// When a metadata block's isLast flag is set to true in preprocess,
// subsequent blocks are automatically discarded.
mdb.isLast = true;
}
});
reader.pipe(processor).pipe(writer);
Injects a VORBIS_COMMENT block (and removes the existing one, if any).
var fs = require("fs");
var flac = require("flac-metadata");
var reader = fs.createReadStream("source.flac");
var writer = fs.createWriteStream("target.flac");
var processor = new flac.Processor();
var mdbVorbis;
var vendor = "reference libFLAC 1.2.1 20070917";
var comments = [
"ARTIST=Boyracer",
"TITLE=I've Got It And It's Not Worth Having",
"ALBUM=B Is For Boyracer",
"TRACKNUMBER=A1",
"DATE=1993"
];
processor.on("preprocess", function(mdb) {
// Remove existing VORBIS_COMMENT block, if any.
if (mdb.type === flac.Processor.MDB_TYPE_VORBIS_COMMENT) {
mdb.remove();
}
// Prepare to add new VORBIS_COMMENT block as last metadata block.
if (mdb.isLast) {
mdb.isLast = false;
mdbVorbis = flac.data.MetaDataBlockVorbisComment.create(true, vendor, comments);
}
});
processor.on("postprocess", function(mdb) {
if (mdbVorbis) {
// Add new VORBIS_COMMENT block as last metadata block.
this.push(mdbVorbis.publish());
}
});
reader.pipe(processor).pipe(writer);
MIT
FAQs
FLAC metadata processor implemented as Transform stream
We found that flac-metadata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.