Library for processing metadata of FLAC (Free Lossless Audio Codec) files, which can be run on Deno, browsers and Node.js.
npm i @gplane/metaflac
import * as fs from 'node:fs/promises'
import { parse, createTagView, dump } from '@gplane/metaflac'
// browsers
const file = await blob.arrayBuffer()
// Node.js
const file = await fs.readFile('./input.flac')
const metadata = parse(file)
const tagView = createTagView(metadata)
// reading tag data
console.log(tagView.artist)
// writing tag data
tagView.title = 'xyz'
// removing
tagView.genre = null
const modifiedFile = dump(metadata, file)
// browsers
new Blob([modifiedFile])
// Node.js
await fs.writeFile('./output.flac', modifiedFile)
MIT License
Copyright (c) 2021-present Pig Fang