taglib-wasm 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -35
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +117 -134
- package/dist/index.js.map +1 -0
- package/dist/src/constants.js +211 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/errors.js +180 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/file-utils.d.ts +2 -2
- package/dist/src/file-utils.d.ts.map +1 -1
- package/dist/src/file-utils.js +394 -0
- package/dist/src/file-utils.js.map +1 -0
- package/dist/src/mod.d.ts +4 -4
- package/dist/src/mod.d.ts.map +1 -1
- package/dist/src/mod.js +7 -0
- package/dist/src/mod.js.map +1 -0
- package/dist/src/simple.d.ts +4 -4
- package/dist/src/simple.d.ts.map +1 -1
- package/dist/src/{simple.ts → simple.js} +193 -311
- package/dist/src/simple.js.map +1 -0
- package/dist/src/taglib.d.ts +3 -3
- package/dist/src/taglib.d.ts.map +1 -1
- package/dist/src/taglib.js +516 -0
- package/dist/src/taglib.js.map +1 -0
- package/dist/src/types.d.ts +2 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +239 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/file.js +65 -0
- package/dist/src/utils/file.js.map +1 -0
- package/dist/src/utils/write.js +49 -0
- package/dist/src/utils/write.js.map +1 -0
- package/dist/src/wasm-workers.d.ts +1 -1
- package/dist/src/wasm-workers.d.ts.map +1 -1
- package/dist/src/wasm-workers.js +148 -0
- package/dist/src/wasm-workers.js.map +1 -0
- package/dist/src/wasm.js +6 -0
- package/dist/src/wasm.js.map +1 -0
- package/dist/src/web-utils.d.ts +2 -2
- package/dist/src/web-utils.d.ts.map +1 -1
- package/{src/web-utils.ts → dist/src/web-utils.js} +102 -184
- package/dist/src/web-utils.js.map +1 -0
- package/dist/src/workers.d.ts +2 -2
- package/dist/src/workers.d.ts.map +1 -1
- package/dist/src/workers.js +389 -0
- package/dist/src/workers.js.map +1 -0
- package/dist/taglib-wrapper.js +8 -2528
- package/package.json +7 -10
- package/dist/index.ts +0 -221
- package/dist/src/constants.ts +0 -227
- package/dist/src/errors.ts +0 -254
- package/dist/src/file-utils.ts +0 -483
- package/dist/src/file.js +0 -52
- package/dist/src/global.d.ts +0 -12
- package/dist/src/mod.ts +0 -19
- package/dist/src/taglib.ts +0 -961
- package/dist/src/types.ts +0 -538
- package/dist/src/utils/file.ts +0 -86
- package/dist/src/utils/write.ts +0 -66
- package/dist/src/wasm-workers.ts +0 -176
- package/dist/src/wasm.ts +0 -133
- package/dist/src/web-utils.ts +0 -347
- package/dist/src/workers.ts +0 -461
- package/dist/src/write.js +0 -33
- package/index.ts +0 -221
- package/lib/taglib/COPYING.LGPL +0 -502
- package/lib/taglib/COPYING.MPL +0 -470
- package/lib/taglib/README.md +0 -24
- package/src/constants.ts +0 -227
- package/src/errors.ts +0 -254
- package/src/file-utils.ts +0 -483
- package/src/global.d.ts +0 -12
- package/src/mod.ts +0 -19
- package/src/simple.ts +0 -667
- package/src/taglib.ts +0 -961
- package/src/types.ts +0 -538
- package/src/utils/file.ts +0 -86
- package/src/utils/write.ts +0 -66
- package/src/wasm-workers.ts +0 -176
- package/src/wasm.ts +0 -133
- package/src/workers.ts +0 -461
package/README.md
CHANGED
|
@@ -4,32 +4,30 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/taglib-wasm)
|
|
5
5
|
[](https://www.npmjs.com/package/taglib-wasm)
|
|
6
6
|
[](https://github.com/CharlesWiltgen/taglib-wasm/blob/main/LICENSE)
|
|
7
|
-
<br>[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://emscripten.org/)
|
|
9
|
+
[](https://webassembly.org/)
|
|
9
10
|
[](https://taglib.org/)
|
|
10
11
|
<br>[](https://deno.land/)
|
|
11
12
|
[](https://nodejs.org/)
|
|
12
13
|
[](https://bun.sh/)
|
|
13
14
|
[](https://workers.cloudflare.com/)
|
|
14
15
|
[](https://www.electronjs.org/)
|
|
15
|
-
[](https://html.spec.whatwg.org/multipage/)
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
Node.js
|
|
19
|
-
|
|
18
|
+
TagLib-Wasm is the **universal tagging library for TypeScript/JavaScript**
|
|
19
|
+
(TS|JS) platforms: **Deno**, **Node.js**, **Bun**, **Cloudflare Workers**,
|
|
20
|
+
**Electron**, and **browsers**.
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
metadata to all popular audio formats. It aspires to be a universal solution for
|
|
26
|
-
all **TypeScript**-capable platforms — Deno, Node.js, Bun, Electron, Cloudflare
|
|
27
|
-
Workers, and browsers.
|
|
22
|
+
This project exists because the TS|JS ecosystem had no battle-tested audio
|
|
23
|
+
tagging library that supports reading and writing music metadata to all popular
|
|
24
|
+
audio formats. It aspires to be a universal solution for all TS|JS-capable
|
|
25
|
+
platforms — Deno, Node.js, Bun, Electron, Cloudflare Workers, and browsers.
|
|
28
26
|
|
|
29
27
|
TagLib-Wasm stands on the shoulders of giants, including
|
|
30
28
|
[TagLib](https://taglib.org/) itself, [Emscripten](https://emscripten.org/), and
|
|
31
29
|
[Wasm](https://webassembly.org/) ([WebAssembly](https://webassembly.org/)).
|
|
32
|
-
TagLib itself is legendary and a core dependency of many music apps.
|
|
30
|
+
TagLib itself is legendary, and a core dependency of many music apps.
|
|
33
31
|
|
|
34
32
|
## 🎯 Features
|
|
35
33
|
|
|
@@ -60,24 +58,9 @@ import { TagLib } from "npm:taglib-wasm";
|
|
|
60
58
|
npm install taglib-wasm
|
|
61
59
|
```
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
# Node.js 22.6.0+ with experimental flag
|
|
69
|
-
node --experimental-strip-types your-script.ts
|
|
70
|
-
|
|
71
|
-
# Node.js 23.6.0+ (no flag needed)
|
|
72
|
-
node your-script.ts
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
#### Option 2: TypeScript loader (recommended for production)
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
npm install --save-dev tsx
|
|
79
|
-
npx tsx your-script.ts
|
|
80
|
-
```
|
|
61
|
+
> **Note:** Requires Node.js v22.6.0 or higher. If you want to use the
|
|
62
|
+
> TypeScript version with Node.js, see the
|
|
63
|
+
> [installation guide](https://charleswiltgen.github.io/taglib-wasm/guide/installation.html).
|
|
81
64
|
|
|
82
65
|
### Bun
|
|
83
66
|
|
|
@@ -103,10 +86,10 @@ const { TagLib } = require("taglib-wasm");
|
|
|
103
86
|
|
|
104
87
|
## 🚀 Quick Start
|
|
105
88
|
|
|
106
|
-
### Simple API
|
|
89
|
+
### Simple API
|
|
107
90
|
|
|
108
91
|
```typescript
|
|
109
|
-
import {
|
|
92
|
+
import { applyTags, readTags, updateTags } from "taglib-wasm/simple";
|
|
110
93
|
|
|
111
94
|
// Read tags - just one function call!
|
|
112
95
|
const tags = await readTags("song.mp3");
|
|
@@ -126,7 +109,10 @@ await updateTags("song.mp3", {
|
|
|
126
109
|
});
|
|
127
110
|
```
|
|
128
111
|
|
|
129
|
-
### Core API
|
|
112
|
+
### Core API
|
|
113
|
+
|
|
114
|
+
The full Core API might be a better choice for apps and utilities focused on
|
|
115
|
+
advanced metadata management.
|
|
130
116
|
|
|
131
117
|
```typescript
|
|
132
118
|
import { TagLib } from "taglib-wasm";
|
|
@@ -199,7 +185,8 @@ const modifiedBuffer = await setCoverArt("song.mp3", imageData, "image/jpeg");
|
|
|
199
185
|
- ✅ **.flac** – Vorbis comments and audio properties
|
|
200
186
|
- ✅ **.ogg** – Ogg Vorbis format with full metadata support
|
|
201
187
|
- ✅ **.wav** – INFO chunk metadata
|
|
202
|
-
- ✅ **Additional formats** – Opus, APE, MPC, WavPack, TrueAudio, AIFF, WMA, and
|
|
188
|
+
- ✅ **Additional formats** – Opus, APE, MPC, WavPack, TrueAudio, AIFF, WMA, and
|
|
189
|
+
more
|
|
203
190
|
|
|
204
191
|
## 🎯 Key Features
|
|
205
192
|
|
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* @see {@link AudioFile} - Audio file interface
|
|
39
39
|
* @see {@link createTagLib} - Factory function for creating TagLib instances
|
|
40
40
|
*/
|
|
41
|
-
export { AudioFileImpl as AudioFile, createTagLib, TagLib, } from "./src/taglib
|
|
41
|
+
export { AudioFileImpl as AudioFile, createTagLib, TagLib, } from "./src/taglib";
|
|
42
42
|
/**
|
|
43
43
|
* Error types for proper error handling and debugging.
|
|
44
44
|
* @see {@link TagLibError} - Base error class for all TagLib errors
|
|
@@ -50,7 +50,7 @@ export { AudioFileImpl as AudioFile, createTagLib, TagLib, } from "./src/taglib.
|
|
|
50
50
|
* @see {@link MemoryError} - Wasm memory allocation issues
|
|
51
51
|
* @see {@link EnvironmentError} - Runtime/environment issues
|
|
52
52
|
*/
|
|
53
|
-
export { EnvironmentError, FileOperationError, InvalidFormatError, isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isTagLibError, isUnsupportedFormatError, MemoryError, MetadataError, SUPPORTED_FORMATS, TagLibError, TagLibInitializationError, UnsupportedFormatError, } from "./src/errors
|
|
53
|
+
export { EnvironmentError, FileOperationError, InvalidFormatError, isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isTagLibError, isUnsupportedFormatError, MemoryError, MetadataError, SUPPORTED_FORMATS, TagLibError, TagLibInitializationError, UnsupportedFormatError, } from "./src/errors";
|
|
54
54
|
/**
|
|
55
55
|
* Simple API exports for easy tag reading and writing.
|
|
56
56
|
* @see {@link readTags} - Read metadata from audio files
|
|
@@ -63,7 +63,7 @@ export { EnvironmentError, FileOperationError, InvalidFormatError, isEnvironment
|
|
|
63
63
|
* @see {@link getCoverArt} - Get primary cover art data
|
|
64
64
|
* @see {@link setCoverArt} - Set primary cover art
|
|
65
65
|
*/
|
|
66
|
-
export { addPicture, applyPictures, applyTags, clearPictures, clearTags, findPictureByType, getCoverArt, getFormat, getPictureMetadata, isValidAudioFile, readPictures, readProperties, readTags, replacePictureByType, setCoverArt, updateTags } from "./src/simple
|
|
66
|
+
export { addPicture, applyPictures, applyTags, clearPictures, clearTags, findPictureByType, getCoverArt, getFormat, getPictureMetadata, isValidAudioFile, readPictures, readProperties, readTags, replacePictureByType, setCoverArt, updateTags, } from "./src/simple";
|
|
67
67
|
/**
|
|
68
68
|
* Constants and utilities for tag name validation.
|
|
69
69
|
* @see {@link Tags} - Standard tag name constants
|
|
@@ -71,21 +71,21 @@ export { addPicture, applyPictures, applyTags, clearPictures, clearTags, findPic
|
|
|
71
71
|
* @see {@link isValidTagName} - Validate tag names
|
|
72
72
|
* @see {@link getAllTagNames} - Get all valid tag names
|
|
73
73
|
*/
|
|
74
|
-
export { FormatMappings, getAllTagNames, isValidTagName, Tags, } from "./src/constants
|
|
74
|
+
export { FormatMappings, getAllTagNames, isValidTagName, Tags, } from "./src/constants";
|
|
75
75
|
/**
|
|
76
76
|
* File I/O utilities for cover art operations.
|
|
77
77
|
* @see {@link exportCoverArt} - Export cover art to file
|
|
78
78
|
* @see {@link importCoverArt} - Import cover art from file
|
|
79
79
|
* @see {@link copyCoverArt} - Copy cover art between files
|
|
80
80
|
*/
|
|
81
|
-
export { copyCoverArt, exportAllPictures, exportCoverArt, exportPictureByType, findCoverArtFiles, importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile, } from "./src/file-utils
|
|
81
|
+
export { copyCoverArt, exportAllPictures, exportCoverArt, exportPictureByType, findCoverArtFiles, importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile, } from "./src/file-utils";
|
|
82
82
|
/**
|
|
83
83
|
* Web browser utilities for cover art operations.
|
|
84
84
|
* @see {@link pictureToDataURL} - Convert picture to data URL
|
|
85
85
|
* @see {@link setCoverArtFromCanvas} - Set cover art from HTML canvas
|
|
86
86
|
* @see {@link displayPicture} - Display picture in HTML img element
|
|
87
87
|
*/
|
|
88
|
-
export { canvasToPicture, createPictureDownloadURL, createPictureGallery, dataURLToPicture, displayPicture, imageFileToPicture, pictureToDataURL, setCoverArtFromCanvas, } from "./src/web-utils
|
|
88
|
+
export { canvasToPicture, createPictureDownloadURL, createPictureGallery, dataURLToPicture, displayPicture, imageFileToPicture, pictureToDataURL, setCoverArtFromCanvas, } from "./src/web-utils";
|
|
89
89
|
/**
|
|
90
90
|
* Type exports for TypeScript users.
|
|
91
91
|
* These types define the structure of metadata, audio properties,
|
|
@@ -96,18 +96,18 @@ export { canvasToPicture, createPictureDownloadURL, createPictureGallery, dataUR
|
|
|
96
96
|
* @see {@link AudioProperties} - Audio technical properties
|
|
97
97
|
* @see {@link TagLibConfig} - Configuration options
|
|
98
98
|
*/
|
|
99
|
-
export type { AudioFormat, AudioProperties, ExtendedTag, FieldMapping, FileType, Picture, PropertyMap, Tag, TagLibConfig, TagName, } from "./src/types
|
|
99
|
+
export type { AudioFormat, AudioProperties, ExtendedTag, FieldMapping, FileType, Picture, PropertyMap, Tag, TagLibConfig, TagName, } from "./src/types";
|
|
100
100
|
/**
|
|
101
101
|
* Enum exports
|
|
102
102
|
*/
|
|
103
|
-
export { PictureType } from "./src/types
|
|
103
|
+
export { PictureType } from "./src/types";
|
|
104
104
|
/**
|
|
105
105
|
* Wasm module types for advanced usage.
|
|
106
106
|
* @see {@link TagLibModule} - Full TagLib Wasm module interface
|
|
107
107
|
* @see {@link WasmModule} - Base Emscripten module interface
|
|
108
108
|
*/
|
|
109
|
-
export type { TagLibModule, WasmModule } from "./src/wasm
|
|
110
|
-
import type { TagLibModule } from "./src/wasm
|
|
109
|
+
export type { TagLibModule, WasmModule } from "./src/wasm";
|
|
110
|
+
import type { TagLibModule } from "./src/wasm";
|
|
111
111
|
/**
|
|
112
112
|
* Load the TagLib Wasm module.
|
|
113
113
|
* This function initializes the WebAssembly module and returns
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;GAKG;AACH,OAAO,EACL,aAAa,IAAI,SAAS,EAC1B,YAAY,EACZ,MAAM,GACP,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;GAKG;AACH,OAAO,EACL,aAAa,IAAI,SAAS,EAC1B,YAAY,EACZ,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;GAUG;AACH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,aAAa,EACb,wBAAwB,EACxB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;GAWG;AACH,OAAO,EACL,UAAU,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,oBAAoB,EACpB,WAAW,EACX,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB;;;;;;GAMG;AACH,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,IAAI,GACL,MAAM,iBAAiB,CAAC;AACzB;;;;;GAKG;AACH,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;GASG;AACH,YAAY,EACV,WAAW,EACX,eAAe,EACf,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,WAAW,EACX,GAAG,EACH,YAAY,EACZ,OAAO,GACR,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;GAIG;AACH,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,CAO9D"}
|
package/dist/index.js
CHANGED
|
@@ -1,135 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from "
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Main module exports for taglib-wasm
|
|
3
|
+
*
|
|
4
|
+
* TagLib v2.1 compiled to WebAssembly with TypeScript bindings
|
|
5
|
+
* for universal audio metadata handling across all JavaScript runtimes.
|
|
6
|
+
*
|
|
7
|
+
* @module taglib-wasm
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Using the Core API
|
|
12
|
+
* import { TagLib } from "taglib-wasm";
|
|
13
|
+
*
|
|
14
|
+
* const taglib = await TagLib.initialize();
|
|
15
|
+
* const file = await taglib.open(audioBuffer);
|
|
16
|
+
* const tag = file.tag();
|
|
17
|
+
* console.log(tag.title);
|
|
18
|
+
* file.dispose();
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // Using the Simple API
|
|
24
|
+
* import { readTags, applyTags } from "taglib-wasm/simple";
|
|
25
|
+
*
|
|
26
|
+
* const tags = await readTags("song.mp3");
|
|
27
|
+
* console.log(tags.artist);
|
|
28
|
+
*
|
|
29
|
+
* const modified = await applyTags("song.mp3", {
|
|
30
|
+
* artist: "New Artist",
|
|
31
|
+
* album: "New Album"
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Core API exports for advanced usage with full control.
|
|
37
|
+
* @see {@link TagLib} - Main TagLib class
|
|
38
|
+
* @see {@link AudioFile} - Audio file interface
|
|
39
|
+
* @see {@link createTagLib} - Factory function for creating TagLib instances
|
|
40
|
+
*/
|
|
41
|
+
export { AudioFileImpl as AudioFile, createTagLib, TagLib, } from "./src/taglib.js";
|
|
42
|
+
/**
|
|
43
|
+
* Error types for proper error handling and debugging.
|
|
44
|
+
* @see {@link TagLibError} - Base error class for all TagLib errors
|
|
45
|
+
* @see {@link TagLibInitializationError} - Wasm initialization failures
|
|
46
|
+
* @see {@link InvalidFormatError} - Invalid or corrupted file format
|
|
47
|
+
* @see {@link UnsupportedFormatError} - Valid but unsupported format
|
|
48
|
+
* @see {@link FileOperationError} - File read/write/save failures
|
|
49
|
+
* @see {@link MetadataError} - Tag reading/writing failures
|
|
50
|
+
* @see {@link MemoryError} - Wasm memory allocation issues
|
|
51
|
+
* @see {@link EnvironmentError} - Runtime/environment issues
|
|
52
|
+
*/
|
|
53
|
+
export { EnvironmentError, FileOperationError, InvalidFormatError, isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isTagLibError, isUnsupportedFormatError, MemoryError, MetadataError, SUPPORTED_FORMATS, TagLibError, TagLibInitializationError, UnsupportedFormatError, } from "./src/errors.js";
|
|
54
|
+
/**
|
|
55
|
+
* Simple API exports for easy tag reading and writing.
|
|
56
|
+
* @see {@link readTags} - Read metadata from audio files
|
|
57
|
+
* @see {@link applyTags} - Apply metadata changes and return modified buffer
|
|
58
|
+
* @see {@link updateTags} - Update metadata and save to disk
|
|
59
|
+
* @see {@link writeTags} - Deprecated alias for applyTags
|
|
60
|
+
* @see {@link readProperties} - Read audio properties
|
|
61
|
+
* @see {@link readPictures} - Read cover art/pictures
|
|
62
|
+
* @see {@link applyPictures} - Apply pictures to audio files
|
|
63
|
+
* @see {@link getCoverArt} - Get primary cover art data
|
|
64
|
+
* @see {@link setCoverArt} - Set primary cover art
|
|
65
|
+
*/
|
|
66
|
+
export { addPicture, applyPictures, applyTags, clearPictures, clearTags, findPictureByType, getCoverArt, getFormat, getPictureMetadata, isValidAudioFile, readPictures, readProperties, readTags, replacePictureByType, setCoverArt, updateTags, } from "./src/simple.js";
|
|
67
|
+
/**
|
|
68
|
+
* Constants and utilities for tag name validation.
|
|
69
|
+
* @see {@link Tags} - Standard tag name constants
|
|
70
|
+
* @see {@link FormatMappings} - Format-specific field mappings
|
|
71
|
+
* @see {@link isValidTagName} - Validate tag names
|
|
72
|
+
* @see {@link getAllTagNames} - Get all valid tag names
|
|
73
|
+
*/
|
|
74
|
+
export { FormatMappings, getAllTagNames, isValidTagName, Tags, } from "./src/constants.js";
|
|
75
|
+
/**
|
|
76
|
+
* File I/O utilities for cover art operations.
|
|
77
|
+
* @see {@link exportCoverArt} - Export cover art to file
|
|
78
|
+
* @see {@link importCoverArt} - Import cover art from file
|
|
79
|
+
* @see {@link copyCoverArt} - Copy cover art between files
|
|
80
|
+
*/
|
|
81
|
+
export { copyCoverArt, exportAllPictures, exportCoverArt, exportPictureByType, findCoverArtFiles, importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile, } from "./src/file-utils.js";
|
|
82
|
+
/**
|
|
83
|
+
* Web browser utilities for cover art operations.
|
|
84
|
+
* @see {@link pictureToDataURL} - Convert picture to data URL
|
|
85
|
+
* @see {@link setCoverArtFromCanvas} - Set cover art from HTML canvas
|
|
86
|
+
* @see {@link displayPicture} - Display picture in HTML img element
|
|
87
|
+
*/
|
|
88
|
+
export { canvasToPicture, createPictureDownloadURL, createPictureGallery, dataURLToPicture, displayPicture, imageFileToPicture, pictureToDataURL, setCoverArtFromCanvas, } from "./src/web-utils.js";
|
|
89
|
+
/**
|
|
90
|
+
* Enum exports
|
|
91
|
+
*/
|
|
92
|
+
export { PictureType } from "./src/types.js";
|
|
93
|
+
/**
|
|
94
|
+
* Load the TagLib Wasm module.
|
|
95
|
+
* This function initializes the WebAssembly module and returns
|
|
96
|
+
* the loaded module for use with the Core API.
|
|
97
|
+
*
|
|
98
|
+
* @returns Promise resolving to the initialized TagLib module
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* import { loadTagLibModule, createTagLib } from "taglib-wasm";
|
|
103
|
+
*
|
|
104
|
+
* // Manual module loading for advanced configuration
|
|
105
|
+
* const module = await loadTagLibModule();
|
|
106
|
+
* const taglib = await createTagLib(module);
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @note Most users should use `TagLib.initialize()` instead,
|
|
110
|
+
* which handles module loading automatically.
|
|
111
|
+
*/
|
|
112
|
+
export async function loadTagLibModule() {
|
|
113
|
+
// Now that we're using ES6 modules, we can use dynamic import directly
|
|
114
|
+
const { default: createTagLibModule } = await import("./build/taglib-wrapper.js");
|
|
115
|
+
const module = await createTagLibModule();
|
|
116
|
+
return module;
|
|
75
117
|
}
|
|
76
|
-
|
|
77
|
-
AudioFileImpl as AudioFile,
|
|
78
|
-
EnvironmentError,
|
|
79
|
-
FileOperationError,
|
|
80
|
-
FormatMappings,
|
|
81
|
-
InvalidFormatError,
|
|
82
|
-
MemoryError,
|
|
83
|
-
MetadataError,
|
|
84
|
-
PictureType,
|
|
85
|
-
SUPPORTED_FORMATS,
|
|
86
|
-
TagLib,
|
|
87
|
-
TagLibError,
|
|
88
|
-
TagLibInitializationError,
|
|
89
|
-
Tags,
|
|
90
|
-
UnsupportedFormatError,
|
|
91
|
-
addPicture,
|
|
92
|
-
applyPictures,
|
|
93
|
-
applyTags,
|
|
94
|
-
canvasToPicture,
|
|
95
|
-
clearPictures,
|
|
96
|
-
clearTags,
|
|
97
|
-
copyCoverArt,
|
|
98
|
-
createPictureDownloadURL,
|
|
99
|
-
createPictureGallery,
|
|
100
|
-
createTagLib,
|
|
101
|
-
dataURLToPicture,
|
|
102
|
-
displayPicture,
|
|
103
|
-
exportAllPictures,
|
|
104
|
-
exportCoverArt,
|
|
105
|
-
exportPictureByType,
|
|
106
|
-
findCoverArtFiles,
|
|
107
|
-
findPictureByType,
|
|
108
|
-
getAllTagNames,
|
|
109
|
-
getCoverArt,
|
|
110
|
-
getFormat,
|
|
111
|
-
getPictureMetadata,
|
|
112
|
-
imageFileToPicture,
|
|
113
|
-
importCoverArt,
|
|
114
|
-
importPictureWithType,
|
|
115
|
-
isEnvironmentError,
|
|
116
|
-
isFileOperationError,
|
|
117
|
-
isInvalidFormatError,
|
|
118
|
-
isMemoryError,
|
|
119
|
-
isMetadataError,
|
|
120
|
-
isTagLibError,
|
|
121
|
-
isUnsupportedFormatError,
|
|
122
|
-
isValidAudioFile,
|
|
123
|
-
isValidTagName,
|
|
124
|
-
loadPictureFromFile,
|
|
125
|
-
loadTagLibModule,
|
|
126
|
-
pictureToDataURL,
|
|
127
|
-
readPictures,
|
|
128
|
-
readProperties,
|
|
129
|
-
readTags,
|
|
130
|
-
replacePictureByType,
|
|
131
|
-
savePictureToFile,
|
|
132
|
-
setCoverArt,
|
|
133
|
-
setCoverArtFromCanvas,
|
|
134
|
-
updateTags
|
|
135
|
-
};
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;GAKG;AACH,OAAO,EACL,aAAa,IAAI,SAAS,EAC1B,YAAY,EACZ,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;GAUG;AACH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,aAAa,EACb,wBAAwB,EACxB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;GAWG;AACH,OAAO,EACL,UAAU,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,oBAAoB,EACpB,WAAW,EACX,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB;;;;;;GAMG;AACH,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,IAAI,GACL,MAAM,iBAAiB,CAAC;AACzB;;;;;GAKG;AACH,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AACH,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAyBzB;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAY1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,uEAAuE;IACvE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAClD,2BAA2B,CAC5B,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAC1C,OAAO,MAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard tag property names used by TagLib.
|
|
3
|
+
* These constants provide type-safe access to tag properties with IDE autocomplete.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { Tags } from 'taglib-wasm';
|
|
8
|
+
*
|
|
9
|
+
* // Read tags
|
|
10
|
+
* const title = file.tag.properties.get(Tags.Title);
|
|
11
|
+
* const artist = file.tag.properties.get(Tags.Artist);
|
|
12
|
+
*
|
|
13
|
+
* // Write tags
|
|
14
|
+
* file.tag.properties.set(Tags.Album, "Dark Side of the Moon");
|
|
15
|
+
* file.tag.properties.set(Tags.Year, "1973");
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const Tags = {
|
|
19
|
+
// Basic Properties
|
|
20
|
+
/** Track/song title */
|
|
21
|
+
Title: "TITLE",
|
|
22
|
+
/** Primary performer(s) */
|
|
23
|
+
Artist: "ARTIST",
|
|
24
|
+
/** Album/collection name */
|
|
25
|
+
Album: "ALBUM",
|
|
26
|
+
/** Date of recording (year) */
|
|
27
|
+
Date: "DATE",
|
|
28
|
+
/** Track number on album */
|
|
29
|
+
TrackNumber: "TRACKNUMBER",
|
|
30
|
+
/** Musical genre */
|
|
31
|
+
Genre: "GENRE",
|
|
32
|
+
/** Comments/notes */
|
|
33
|
+
Comment: "COMMENT",
|
|
34
|
+
// Extended Properties
|
|
35
|
+
/** Band/orchestra/ensemble */
|
|
36
|
+
AlbumArtist: "ALBUMARTIST",
|
|
37
|
+
/** Original composer(s) */
|
|
38
|
+
Composer: "COMPOSER",
|
|
39
|
+
/** Copyright information */
|
|
40
|
+
Copyright: "COPYRIGHT",
|
|
41
|
+
/** Encoding software/person */
|
|
42
|
+
EncodedBy: "ENCODEDBY",
|
|
43
|
+
/** Disc number for multi-disc sets */
|
|
44
|
+
DiscNumber: "DISCNUMBER",
|
|
45
|
+
/** Beats per minute */
|
|
46
|
+
Bpm: "BPM",
|
|
47
|
+
/** Lyrics/text writer(s) */
|
|
48
|
+
Lyricist: "LYRICIST",
|
|
49
|
+
/** Conductor */
|
|
50
|
+
Conductor: "CONDUCTOR",
|
|
51
|
+
/** Person who remixed */
|
|
52
|
+
Remixer: "REMIXEDBY",
|
|
53
|
+
/** Language of vocals/lyrics */
|
|
54
|
+
Language: "LANGUAGE",
|
|
55
|
+
/** Publisher */
|
|
56
|
+
Publisher: "PUBLISHER",
|
|
57
|
+
/** Mood/atmosphere */
|
|
58
|
+
Mood: "MOOD",
|
|
59
|
+
/** Media type (CD, vinyl, etc.) */
|
|
60
|
+
Media: "MEDIA",
|
|
61
|
+
/** Radio station owner */
|
|
62
|
+
RadioStationOwner: "RADIOSTATIONOWNER",
|
|
63
|
+
/** Producer */
|
|
64
|
+
Producer: "PRODUCER",
|
|
65
|
+
/** Album subtitle */
|
|
66
|
+
Subtitle: "SUBTITLE",
|
|
67
|
+
/** Release label */
|
|
68
|
+
Label: "LABEL",
|
|
69
|
+
// Sorting Properties
|
|
70
|
+
/** Sort name for title */
|
|
71
|
+
TitleSort: "TITLESORT",
|
|
72
|
+
/** Sort name for artist */
|
|
73
|
+
ArtistSort: "ARTISTSORT",
|
|
74
|
+
/** Sort name for album artist */
|
|
75
|
+
AlbumArtistSort: "ALBUMARTISTSORT",
|
|
76
|
+
/** Sort name for album */
|
|
77
|
+
AlbumSort: "ALBUMSORT",
|
|
78
|
+
/** Sort name for composer */
|
|
79
|
+
ComposerSort: "COMPOSERSORT",
|
|
80
|
+
// Identifiers
|
|
81
|
+
/** International Standard Recording Code */
|
|
82
|
+
Isrc: "ISRC",
|
|
83
|
+
/** Amazon Standard Identification Number */
|
|
84
|
+
Asin: "ASIN",
|
|
85
|
+
/** Catalog number */
|
|
86
|
+
CatalogNumber: "CATALOGNUMBER",
|
|
87
|
+
/** Barcode (EAN/UPC) */
|
|
88
|
+
Barcode: "BARCODE",
|
|
89
|
+
// MusicBrainz Identifiers
|
|
90
|
+
/** MusicBrainz Artist ID */
|
|
91
|
+
MusicBrainzArtistId: "MUSICBRAINZ_ARTISTID",
|
|
92
|
+
/** MusicBrainz Release Artist ID */
|
|
93
|
+
MusicBrainzReleaseArtistId: "MUSICBRAINZ_ALBUMARTISTID",
|
|
94
|
+
/** MusicBrainz Work ID */
|
|
95
|
+
MusicBrainzWorkId: "MUSICBRAINZ_WORKID",
|
|
96
|
+
/** MusicBrainz Release ID */
|
|
97
|
+
MusicBrainzReleaseId: "MUSICBRAINZ_ALBUMID",
|
|
98
|
+
/** MusicBrainz Recording ID */
|
|
99
|
+
MusicBrainzRecordingId: "MUSICBRAINZ_TRACKID",
|
|
100
|
+
/** MusicBrainz Track ID (deprecated, use RecordingId) */
|
|
101
|
+
MusicBrainzTrackId: "MUSICBRAINZ_TRACKID",
|
|
102
|
+
/** MusicBrainz Release Group ID */
|
|
103
|
+
MusicBrainzReleaseGroupId: "MUSICBRAINZ_RELEASEGROUPID",
|
|
104
|
+
/** MusicBrainz Release Track ID */
|
|
105
|
+
MusicBrainzReleaseTrackId: "MUSICBRAINZ_RELEASETRACKID",
|
|
106
|
+
// Podcast Properties
|
|
107
|
+
/** Podcast identifier */
|
|
108
|
+
PodcastId: "PODCASTID",
|
|
109
|
+
/** Podcast URL */
|
|
110
|
+
PodcastUrl: "PODCASTURL",
|
|
111
|
+
// Grouping and Work
|
|
112
|
+
/** Content group/work */
|
|
113
|
+
Grouping: "GROUPING",
|
|
114
|
+
/** Work name */
|
|
115
|
+
Work: "WORK",
|
|
116
|
+
// Additional Metadata
|
|
117
|
+
/** Lyrics content */
|
|
118
|
+
Lyrics: "LYRICS",
|
|
119
|
+
/** Album gain (ReplayGain) */
|
|
120
|
+
AlbumGain: "REPLAYGAIN_ALBUM_GAIN",
|
|
121
|
+
/** Album peak (ReplayGain) */
|
|
122
|
+
AlbumPeak: "REPLAYGAIN_ALBUM_PEAK",
|
|
123
|
+
/** Track gain (ReplayGain) */
|
|
124
|
+
TrackGain: "REPLAYGAIN_TRACK_GAIN",
|
|
125
|
+
/** Track peak (ReplayGain) */
|
|
126
|
+
TrackPeak: "REPLAYGAIN_TRACK_PEAK",
|
|
127
|
+
// Special handling
|
|
128
|
+
/** Original artist for covers */
|
|
129
|
+
OriginalArtist: "ORIGINALARTIST",
|
|
130
|
+
/** Original album */
|
|
131
|
+
OriginalAlbum: "ORIGINALALBUM",
|
|
132
|
+
/** Original release date */
|
|
133
|
+
OriginalDate: "ORIGINALDATE",
|
|
134
|
+
/** Script/writing system */
|
|
135
|
+
Script: "SCRIPT",
|
|
136
|
+
/** Involved people list */
|
|
137
|
+
InvolvedPeopleList: "INVOLVEDPEOPLELIST",
|
|
138
|
+
// Technical Properties
|
|
139
|
+
/** Encoder settings/software */
|
|
140
|
+
EncoderSettings: "ENCODERSETTINGS",
|
|
141
|
+
/** Source media */
|
|
142
|
+
SourceMedia: "SOURCEMEDIA",
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Type guard to check if a string is a valid tag name
|
|
146
|
+
*/
|
|
147
|
+
export function isValidTagName(name) {
|
|
148
|
+
return Object.values(Tags).includes(name);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get all available tag names as an array
|
|
152
|
+
*/
|
|
153
|
+
export function getAllTagNames() {
|
|
154
|
+
return Object.values(Tags);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Format-specific tag mappings (for reference only - TagLib handles these automatically)
|
|
158
|
+
* This shows how standard property names map to format-specific identifiers.
|
|
159
|
+
*/
|
|
160
|
+
export const FormatMappings = {
|
|
161
|
+
Title: {
|
|
162
|
+
id3v2: "TIT2",
|
|
163
|
+
mp4: "©nam",
|
|
164
|
+
vorbis: "TITLE",
|
|
165
|
+
ape: "Title",
|
|
166
|
+
riff: "INAM",
|
|
167
|
+
},
|
|
168
|
+
Artist: {
|
|
169
|
+
id3v2: "TPE1",
|
|
170
|
+
mp4: "©ART",
|
|
171
|
+
vorbis: "ARTIST",
|
|
172
|
+
ape: "Artist",
|
|
173
|
+
riff: "IART",
|
|
174
|
+
},
|
|
175
|
+
Album: {
|
|
176
|
+
id3v2: "TALB",
|
|
177
|
+
mp4: "©alb",
|
|
178
|
+
vorbis: "ALBUM",
|
|
179
|
+
ape: "Album",
|
|
180
|
+
riff: "IPRD",
|
|
181
|
+
},
|
|
182
|
+
Date: {
|
|
183
|
+
id3v2: "TDRC",
|
|
184
|
+
mp4: "©day",
|
|
185
|
+
vorbis: "DATE",
|
|
186
|
+
ape: "Year",
|
|
187
|
+
riff: "ICRD",
|
|
188
|
+
},
|
|
189
|
+
Genre: {
|
|
190
|
+
id3v2: "TCON",
|
|
191
|
+
mp4: "©gen",
|
|
192
|
+
vorbis: "GENRE",
|
|
193
|
+
ape: "Genre",
|
|
194
|
+
riff: "IGNR",
|
|
195
|
+
},
|
|
196
|
+
Comment: {
|
|
197
|
+
id3v2: "COMM",
|
|
198
|
+
mp4: "©cmt",
|
|
199
|
+
vorbis: "COMMENT",
|
|
200
|
+
ape: "Comment",
|
|
201
|
+
riff: "ICMT",
|
|
202
|
+
},
|
|
203
|
+
TrackNumber: {
|
|
204
|
+
id3v2: "TRCK",
|
|
205
|
+
mp4: "trkn",
|
|
206
|
+
vorbis: "TRACKNUMBER",
|
|
207
|
+
ape: "Track",
|
|
208
|
+
riff: "ITRK",
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
//# sourceMappingURL=constants.js.map
|