taglib-wasm 0.3.3 → 0.3.9

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.
Files changed (68) hide show
  1. package/CONTRIBUTING.md +293 -0
  2. package/NOTICE +34 -0
  3. package/README.md +122 -511
  4. package/dist/index.d.ts +132 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +137 -0
  7. package/dist/index.ts +220 -0
  8. package/dist/src/constants.d.ts +201 -0
  9. package/dist/src/constants.d.ts.map +1 -0
  10. package/dist/src/constants.ts +227 -0
  11. package/dist/src/errors.d.ts +89 -0
  12. package/dist/src/errors.d.ts.map +1 -0
  13. package/dist/src/errors.ts +237 -0
  14. package/dist/src/file-utils.d.ts +205 -0
  15. package/dist/src/file-utils.d.ts.map +1 -0
  16. package/dist/src/file-utils.ts +467 -0
  17. package/dist/src/file.js +47 -0
  18. package/dist/src/global.d.ts +10 -0
  19. package/dist/src/mod.d.ts +9 -0
  20. package/dist/src/mod.d.ts.map +1 -0
  21. package/dist/src/mod.ts +19 -0
  22. package/dist/src/simple.d.ts +347 -0
  23. package/dist/src/simple.d.ts.map +1 -0
  24. package/dist/src/simple.ts +659 -0
  25. package/dist/src/taglib.d.ts +502 -0
  26. package/dist/src/taglib.d.ts.map +1 -0
  27. package/dist/src/taglib.ts +959 -0
  28. package/dist/src/types.d.ts +323 -0
  29. package/dist/src/types.d.ts.map +1 -0
  30. package/dist/src/types.ts +538 -0
  31. package/dist/src/utils/file.d.ts +15 -0
  32. package/dist/src/utils/file.d.ts.map +1 -0
  33. package/dist/src/utils/file.ts +82 -0
  34. package/dist/src/utils/write.d.ts +15 -0
  35. package/dist/src/utils/write.d.ts.map +1 -0
  36. package/dist/src/utils/write.ts +61 -0
  37. package/dist/src/wasm-workers.d.ts +33 -0
  38. package/dist/src/wasm-workers.d.ts.map +1 -0
  39. package/dist/src/wasm-workers.ts +176 -0
  40. package/dist/src/wasm.d.ts +97 -0
  41. package/dist/src/wasm.d.ts.map +1 -0
  42. package/dist/src/wasm.ts +133 -0
  43. package/dist/src/web-utils.d.ts +180 -0
  44. package/dist/src/web-utils.d.ts.map +1 -0
  45. package/dist/src/web-utils.ts +347 -0
  46. package/dist/src/workers.d.ts +219 -0
  47. package/dist/src/workers.d.ts.map +1 -0
  48. package/dist/src/workers.ts +465 -0
  49. package/dist/src/write.js +33 -0
  50. package/dist/taglib-wrapper.d.ts +5 -0
  51. package/dist/taglib-wrapper.js +14 -0
  52. package/dist/taglib.wasm +0 -0
  53. package/index.ts +100 -7
  54. package/package.json +40 -16
  55. package/src/errors.ts +237 -0
  56. package/src/file-utils.ts +467 -0
  57. package/src/global.d.ts +10 -0
  58. package/src/simple.ts +399 -84
  59. package/src/taglib.ts +522 -28
  60. package/src/types.ts +1 -1
  61. package/src/utils/file.ts +82 -0
  62. package/src/utils/write.ts +61 -0
  63. package/src/wasm-workers.ts +13 -4
  64. package/src/wasm.ts +1 -1
  65. package/src/web-utils.ts +347 -0
  66. package/src/workers.ts +32 -13
  67. package/build/taglib.js +0 -2407
  68. package/build/taglib.wasm +0 -0
@@ -0,0 +1,132 @@
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";
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.ts";
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.ts";
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 { readProperties, readTags, applyTags, updateTags, writeTags, // Deprecated but exported for backward compatibility
67
+ readPictures, applyPictures, addPicture, clearPictures, getCoverArt, setCoverArt, findPictureByType, replacePictureByType, getPictureMetadata, isValidAudioFile, getFormat, clearTags } from "./src/simple.ts";
68
+ /**
69
+ * Constants and utilities for tag name validation.
70
+ * @see {@link Tags} - Standard tag name constants
71
+ * @see {@link FormatMappings} - Format-specific field mappings
72
+ * @see {@link isValidTagName} - Validate tag names
73
+ * @see {@link getAllTagNames} - Get all valid tag names
74
+ */
75
+ export { FormatMappings, getAllTagNames, isValidTagName, Tags, } from "./src/constants.ts";
76
+ /**
77
+ * File I/O utilities for cover art operations.
78
+ * @see {@link exportCoverArt} - Export cover art to file
79
+ * @see {@link importCoverArt} - Import cover art from file
80
+ * @see {@link copyCoverArt} - Copy cover art between files
81
+ */
82
+ export { exportCoverArt, exportPictureByType, exportAllPictures, importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile, copyCoverArt, findCoverArtFiles } from "./src/file-utils.ts";
83
+ /**
84
+ * Web browser utilities for cover art operations.
85
+ * @see {@link pictureToDataURL} - Convert picture to data URL
86
+ * @see {@link setCoverArtFromCanvas} - Set cover art from HTML canvas
87
+ * @see {@link displayPicture} - Display picture in HTML img element
88
+ */
89
+ export { pictureToDataURL, dataURLToPicture, setCoverArtFromCanvas, canvasToPicture, imageFileToPicture, displayPicture, createPictureDownloadURL, createPictureGallery } from "./src/web-utils.ts";
90
+ /**
91
+ * Type exports for TypeScript users.
92
+ * These types define the structure of metadata, audio properties,
93
+ * and configuration options used throughout the library.
94
+ *
95
+ * @see {@link Tag} - Basic metadata structure
96
+ * @see {@link ExtendedTag} - Extended metadata with advanced fields
97
+ * @see {@link AudioProperties} - Audio technical properties
98
+ * @see {@link TagLibConfig} - Configuration options
99
+ */
100
+ export type { AudioFormat, AudioProperties, ExtendedTag, FieldMapping, FileType, Picture, PropertyMap, Tag, TagLibConfig, TagName, } from "./src/types.ts";
101
+ /**
102
+ * Enum exports
103
+ */
104
+ export { PictureType } from "./src/types.ts";
105
+ /**
106
+ * Wasm module types for advanced usage.
107
+ * @see {@link TagLibModule} - Full TagLib Wasm module interface
108
+ * @see {@link WasmModule} - Base Emscripten module interface
109
+ */
110
+ export type { TagLibModule, WasmModule } from "./src/wasm.ts";
111
+ import type { TagLibModule } from "./src/wasm.ts";
112
+ /**
113
+ * Load the TagLib Wasm module.
114
+ * This function initializes the WebAssembly module and returns
115
+ * the loaded module for use with the Core API.
116
+ *
117
+ * @returns Promise resolving to the initialized TagLib module
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * import { loadTagLibModule, createTagLib } from "taglib-wasm";
122
+ *
123
+ * // Manual module loading for advanced configuration
124
+ * const module = await loadTagLibModule();
125
+ * const taglib = await createTagLib(module);
126
+ * ```
127
+ *
128
+ * @note Most users should use `TagLib.initialize()` instead,
129
+ * which handles module loading automatically.
130
+ */
131
+ export declare function loadTagLibModule(): Promise<TagLibModule>;
132
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,iBAAiB,CAAC;AAEzB;;;;;;;;;;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,iBAAiB,CAAC;AAEzB;;;;;;;;;;;GAWG;AACH,OAAO,EACL,cAAc,EACd,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EAAG,qDAAqD;AACjE,YAAY,EACZ,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;;;;GAMG;AACH,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,IAAI,GACL,MAAM,oBAAoB,CAAC;AAC5B;;;;;GAKG;AACH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;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,gBAAgB,CAAC;AAExB;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,CAK9D"}
package/dist/index.js ADDED
@@ -0,0 +1,137 @@
1
+ // index.ts
2
+ import {
3
+ AudioFileImpl,
4
+ createTagLib,
5
+ TagLib
6
+ } from "./src/taglib.ts";
7
+ import {
8
+ EnvironmentError,
9
+ FileOperationError,
10
+ InvalidFormatError,
11
+ isEnvironmentError,
12
+ isFileOperationError,
13
+ isInvalidFormatError,
14
+ isMemoryError,
15
+ isMetadataError,
16
+ isTagLibError,
17
+ isUnsupportedFormatError,
18
+ MemoryError,
19
+ MetadataError,
20
+ SUPPORTED_FORMATS,
21
+ TagLibError,
22
+ TagLibInitializationError,
23
+ UnsupportedFormatError
24
+ } from "./src/errors.ts";
25
+ import {
26
+ readProperties,
27
+ readTags,
28
+ applyTags,
29
+ updateTags,
30
+ writeTags,
31
+ readPictures,
32
+ applyPictures,
33
+ addPicture,
34
+ clearPictures,
35
+ getCoverArt,
36
+ setCoverArt,
37
+ findPictureByType,
38
+ replacePictureByType,
39
+ getPictureMetadata,
40
+ isValidAudioFile,
41
+ getFormat,
42
+ clearTags
43
+ } from "./src/simple.ts";
44
+ import {
45
+ FormatMappings,
46
+ getAllTagNames,
47
+ isValidTagName,
48
+ Tags
49
+ } from "./src/constants.ts";
50
+ import {
51
+ exportCoverArt,
52
+ exportPictureByType,
53
+ exportAllPictures,
54
+ importCoverArt,
55
+ importPictureWithType,
56
+ loadPictureFromFile,
57
+ savePictureToFile,
58
+ copyCoverArt,
59
+ findCoverArtFiles
60
+ } from "./src/file-utils.ts";
61
+ import {
62
+ pictureToDataURL,
63
+ dataURLToPicture,
64
+ setCoverArtFromCanvas,
65
+ canvasToPicture,
66
+ imageFileToPicture,
67
+ displayPicture,
68
+ createPictureDownloadURL,
69
+ createPictureGallery
70
+ } from "./src/web-utils.ts";
71
+ import { PictureType } from "./src/types.ts";
72
+ async function loadTagLibModule() {
73
+ const { default: createTagLibModule } = await import("./build/taglib-wrapper.js");
74
+ const module = await createTagLibModule();
75
+ return module;
76
+ }
77
+ export {
78
+ AudioFileImpl as AudioFile,
79
+ EnvironmentError,
80
+ FileOperationError,
81
+ FormatMappings,
82
+ InvalidFormatError,
83
+ MemoryError,
84
+ MetadataError,
85
+ PictureType,
86
+ SUPPORTED_FORMATS,
87
+ TagLib,
88
+ TagLibError,
89
+ TagLibInitializationError,
90
+ Tags,
91
+ UnsupportedFormatError,
92
+ addPicture,
93
+ applyPictures,
94
+ applyTags,
95
+ canvasToPicture,
96
+ clearPictures,
97
+ clearTags,
98
+ copyCoverArt,
99
+ createPictureDownloadURL,
100
+ createPictureGallery,
101
+ createTagLib,
102
+ dataURLToPicture,
103
+ displayPicture,
104
+ exportAllPictures,
105
+ exportCoverArt,
106
+ exportPictureByType,
107
+ findCoverArtFiles,
108
+ findPictureByType,
109
+ getAllTagNames,
110
+ getCoverArt,
111
+ getFormat,
112
+ getPictureMetadata,
113
+ imageFileToPicture,
114
+ importCoverArt,
115
+ importPictureWithType,
116
+ isEnvironmentError,
117
+ isFileOperationError,
118
+ isInvalidFormatError,
119
+ isMemoryError,
120
+ isMetadataError,
121
+ isTagLibError,
122
+ isUnsupportedFormatError,
123
+ isValidAudioFile,
124
+ isValidTagName,
125
+ loadPictureFromFile,
126
+ loadTagLibModule,
127
+ pictureToDataURL,
128
+ readPictures,
129
+ readProperties,
130
+ readTags,
131
+ replacePictureByType,
132
+ savePictureToFile,
133
+ setCoverArt,
134
+ setCoverArtFromCanvas,
135
+ updateTags,
136
+ writeTags
137
+ };
package/dist/index.ts ADDED
@@ -0,0 +1,220 @@
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";
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
+ /**
37
+ * Core API exports for advanced usage with full control.
38
+ * @see {@link TagLib} - Main TagLib class
39
+ * @see {@link AudioFile} - Audio file interface
40
+ * @see {@link createTagLib} - Factory function for creating TagLib instances
41
+ */
42
+ export {
43
+ AudioFileImpl as AudioFile,
44
+ createTagLib,
45
+ TagLib,
46
+ } from "./src/taglib.ts";
47
+
48
+ /**
49
+ * Error types for proper error handling and debugging.
50
+ * @see {@link TagLibError} - Base error class for all TagLib errors
51
+ * @see {@link TagLibInitializationError} - Wasm initialization failures
52
+ * @see {@link InvalidFormatError} - Invalid or corrupted file format
53
+ * @see {@link UnsupportedFormatError} - Valid but unsupported format
54
+ * @see {@link FileOperationError} - File read/write/save failures
55
+ * @see {@link MetadataError} - Tag reading/writing failures
56
+ * @see {@link MemoryError} - Wasm memory allocation issues
57
+ * @see {@link EnvironmentError} - Runtime/environment issues
58
+ */
59
+ export {
60
+ EnvironmentError,
61
+ FileOperationError,
62
+ InvalidFormatError,
63
+ isEnvironmentError,
64
+ isFileOperationError,
65
+ isInvalidFormatError,
66
+ isMemoryError,
67
+ isMetadataError,
68
+ isTagLibError,
69
+ isUnsupportedFormatError,
70
+ MemoryError,
71
+ MetadataError,
72
+ SUPPORTED_FORMATS,
73
+ TagLibError,
74
+ TagLibInitializationError,
75
+ UnsupportedFormatError,
76
+ } from "./src/errors.ts";
77
+
78
+ /**
79
+ * Simple API exports for easy tag reading and writing.
80
+ * @see {@link readTags} - Read metadata from audio files
81
+ * @see {@link applyTags} - Apply metadata changes and return modified buffer
82
+ * @see {@link updateTags} - Update metadata and save to disk
83
+ * @see {@link writeTags} - Deprecated alias for applyTags
84
+ * @see {@link readProperties} - Read audio properties
85
+ * @see {@link readPictures} - Read cover art/pictures
86
+ * @see {@link applyPictures} - Apply pictures to audio files
87
+ * @see {@link getCoverArt} - Get primary cover art data
88
+ * @see {@link setCoverArt} - Set primary cover art
89
+ */
90
+ export {
91
+ readProperties,
92
+ readTags,
93
+ applyTags,
94
+ updateTags,
95
+ writeTags, // Deprecated but exported for backward compatibility
96
+ readPictures,
97
+ applyPictures,
98
+ addPicture,
99
+ clearPictures,
100
+ getCoverArt,
101
+ setCoverArt,
102
+ findPictureByType,
103
+ replacePictureByType,
104
+ getPictureMetadata,
105
+ isValidAudioFile,
106
+ getFormat,
107
+ clearTags
108
+ } from "./src/simple.ts";
109
+
110
+ /**
111
+ * Constants and utilities for tag name validation.
112
+ * @see {@link Tags} - Standard tag name constants
113
+ * @see {@link FormatMappings} - Format-specific field mappings
114
+ * @see {@link isValidTagName} - Validate tag names
115
+ * @see {@link getAllTagNames} - Get all valid tag names
116
+ */
117
+ export {
118
+ FormatMappings,
119
+ getAllTagNames,
120
+ isValidTagName,
121
+ Tags,
122
+ } from "./src/constants.ts";
123
+ /**
124
+ * File I/O utilities for cover art operations.
125
+ * @see {@link exportCoverArt} - Export cover art to file
126
+ * @see {@link importCoverArt} - Import cover art from file
127
+ * @see {@link copyCoverArt} - Copy cover art between files
128
+ */
129
+ export {
130
+ exportCoverArt,
131
+ exportPictureByType,
132
+ exportAllPictures,
133
+ importCoverArt,
134
+ importPictureWithType,
135
+ loadPictureFromFile,
136
+ savePictureToFile,
137
+ copyCoverArt,
138
+ findCoverArtFiles
139
+ } from "./src/file-utils.ts";
140
+
141
+ /**
142
+ * Web browser utilities for cover art operations.
143
+ * @see {@link pictureToDataURL} - Convert picture to data URL
144
+ * @see {@link setCoverArtFromCanvas} - Set cover art from HTML canvas
145
+ * @see {@link displayPicture} - Display picture in HTML img element
146
+ */
147
+ export {
148
+ pictureToDataURL,
149
+ dataURLToPicture,
150
+ setCoverArtFromCanvas,
151
+ canvasToPicture,
152
+ imageFileToPicture,
153
+ displayPicture,
154
+ createPictureDownloadURL,
155
+ createPictureGallery
156
+ } from "./src/web-utils.ts";
157
+
158
+ /**
159
+ * Type exports for TypeScript users.
160
+ * These types define the structure of metadata, audio properties,
161
+ * and configuration options used throughout the library.
162
+ *
163
+ * @see {@link Tag} - Basic metadata structure
164
+ * @see {@link ExtendedTag} - Extended metadata with advanced fields
165
+ * @see {@link AudioProperties} - Audio technical properties
166
+ * @see {@link TagLibConfig} - Configuration options
167
+ */
168
+ export type {
169
+ AudioFormat,
170
+ AudioProperties,
171
+ ExtendedTag,
172
+ FieldMapping,
173
+ FileType,
174
+ Picture,
175
+ PropertyMap,
176
+ Tag,
177
+ TagLibConfig,
178
+ TagName,
179
+ } from "./src/types.ts";
180
+
181
+ /**
182
+ * Enum exports
183
+ */
184
+ export { PictureType } from "./src/types.ts";
185
+
186
+ /**
187
+ * Wasm module types for advanced usage.
188
+ * @see {@link TagLibModule} - Full TagLib Wasm module interface
189
+ * @see {@link WasmModule} - Base Emscripten module interface
190
+ */
191
+ export type { TagLibModule, WasmModule } from "./src/wasm.ts";
192
+
193
+ // Import the type for use in this file
194
+ import type { TagLibModule } from "./src/wasm.ts";
195
+
196
+ /**
197
+ * Load the TagLib Wasm module.
198
+ * This function initializes the WebAssembly module and returns
199
+ * the loaded module for use with the Core API.
200
+ *
201
+ * @returns Promise resolving to the initialized TagLib module
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * import { loadTagLibModule, createTagLib } from "taglib-wasm";
206
+ *
207
+ * // Manual module loading for advanced configuration
208
+ * const module = await loadTagLibModule();
209
+ * const taglib = await createTagLib(module);
210
+ * ```
211
+ *
212
+ * @note Most users should use `TagLib.initialize()` instead,
213
+ * which handles module loading automatically.
214
+ */
215
+ export async function loadTagLibModule(): Promise<TagLibModule> {
216
+ // Now that we're using ES6 modules, we can use dynamic import directly
217
+ const { default: createTagLibModule } = await import("./build/taglib-wrapper.js");
218
+ const module = await createTagLibModule();
219
+ return module as TagLibModule;
220
+ }
@@ -0,0 +1,201 @@
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 declare const Tags: {
19
+ /** Track/song title */
20
+ readonly Title: "TITLE";
21
+ /** Primary performer(s) */
22
+ readonly Artist: "ARTIST";
23
+ /** Album/collection name */
24
+ readonly Album: "ALBUM";
25
+ /** Date of recording (year) */
26
+ readonly Date: "DATE";
27
+ /** Track number on album */
28
+ readonly TrackNumber: "TRACKNUMBER";
29
+ /** Musical genre */
30
+ readonly Genre: "GENRE";
31
+ /** Comments/notes */
32
+ readonly Comment: "COMMENT";
33
+ /** Band/orchestra/ensemble */
34
+ readonly AlbumArtist: "ALBUMARTIST";
35
+ /** Original composer(s) */
36
+ readonly Composer: "COMPOSER";
37
+ /** Copyright information */
38
+ readonly Copyright: "COPYRIGHT";
39
+ /** Encoding software/person */
40
+ readonly EncodedBy: "ENCODEDBY";
41
+ /** Disc number for multi-disc sets */
42
+ readonly DiscNumber: "DISCNUMBER";
43
+ /** Beats per minute */
44
+ readonly Bpm: "BPM";
45
+ /** Lyrics/text writer(s) */
46
+ readonly Lyricist: "LYRICIST";
47
+ /** Conductor */
48
+ readonly Conductor: "CONDUCTOR";
49
+ /** Person who remixed */
50
+ readonly Remixer: "REMIXEDBY";
51
+ /** Language of vocals/lyrics */
52
+ readonly Language: "LANGUAGE";
53
+ /** Publisher */
54
+ readonly Publisher: "PUBLISHER";
55
+ /** Mood/atmosphere */
56
+ readonly Mood: "MOOD";
57
+ /** Media type (CD, vinyl, etc.) */
58
+ readonly Media: "MEDIA";
59
+ /** Radio station owner */
60
+ readonly RadioStationOwner: "RADIOSTATIONOWNER";
61
+ /** Producer */
62
+ readonly Producer: "PRODUCER";
63
+ /** Album subtitle */
64
+ readonly Subtitle: "SUBTITLE";
65
+ /** Release label */
66
+ readonly Label: "LABEL";
67
+ /** Sort name for title */
68
+ readonly TitleSort: "TITLESORT";
69
+ /** Sort name for artist */
70
+ readonly ArtistSort: "ARTISTSORT";
71
+ /** Sort name for album artist */
72
+ readonly AlbumArtistSort: "ALBUMARTISTSORT";
73
+ /** Sort name for album */
74
+ readonly AlbumSort: "ALBUMSORT";
75
+ /** Sort name for composer */
76
+ readonly ComposerSort: "COMPOSERSORT";
77
+ /** International Standard Recording Code */
78
+ readonly Isrc: "ISRC";
79
+ /** Amazon Standard Identification Number */
80
+ readonly Asin: "ASIN";
81
+ /** Catalog number */
82
+ readonly CatalogNumber: "CATALOGNUMBER";
83
+ /** Barcode (EAN/UPC) */
84
+ readonly Barcode: "BARCODE";
85
+ /** MusicBrainz Artist ID */
86
+ readonly MusicBrainzArtistId: "MUSICBRAINZ_ARTISTID";
87
+ /** MusicBrainz Release Artist ID */
88
+ readonly MusicBrainzReleaseArtistId: "MUSICBRAINZ_ALBUMARTISTID";
89
+ /** MusicBrainz Work ID */
90
+ readonly MusicBrainzWorkId: "MUSICBRAINZ_WORKID";
91
+ /** MusicBrainz Release ID */
92
+ readonly MusicBrainzReleaseId: "MUSICBRAINZ_ALBUMID";
93
+ /** MusicBrainz Recording ID */
94
+ readonly MusicBrainzRecordingId: "MUSICBRAINZ_TRACKID";
95
+ /** MusicBrainz Track ID (deprecated, use RecordingId) */
96
+ readonly MusicBrainzTrackId: "MUSICBRAINZ_TRACKID";
97
+ /** MusicBrainz Release Group ID */
98
+ readonly MusicBrainzReleaseGroupId: "MUSICBRAINZ_RELEASEGROUPID";
99
+ /** MusicBrainz Release Track ID */
100
+ readonly MusicBrainzReleaseTrackId: "MUSICBRAINZ_RELEASETRACKID";
101
+ /** Podcast identifier */
102
+ readonly PodcastId: "PODCASTID";
103
+ /** Podcast URL */
104
+ readonly PodcastUrl: "PODCASTURL";
105
+ /** Content group/work */
106
+ readonly Grouping: "GROUPING";
107
+ /** Work name */
108
+ readonly Work: "WORK";
109
+ /** Lyrics content */
110
+ readonly Lyrics: "LYRICS";
111
+ /** Album gain (ReplayGain) */
112
+ readonly AlbumGain: "REPLAYGAIN_ALBUM_GAIN";
113
+ /** Album peak (ReplayGain) */
114
+ readonly AlbumPeak: "REPLAYGAIN_ALBUM_PEAK";
115
+ /** Track gain (ReplayGain) */
116
+ readonly TrackGain: "REPLAYGAIN_TRACK_GAIN";
117
+ /** Track peak (ReplayGain) */
118
+ readonly TrackPeak: "REPLAYGAIN_TRACK_PEAK";
119
+ /** Original artist for covers */
120
+ readonly OriginalArtist: "ORIGINALARTIST";
121
+ /** Original album */
122
+ readonly OriginalAlbum: "ORIGINALALBUM";
123
+ /** Original release date */
124
+ readonly OriginalDate: "ORIGINALDATE";
125
+ /** Script/writing system */
126
+ readonly Script: "SCRIPT";
127
+ /** Involved people list */
128
+ readonly InvolvedPeopleList: "INVOLVEDPEOPLELIST";
129
+ /** Encoder settings/software */
130
+ readonly EncoderSettings: "ENCODERSETTINGS";
131
+ /** Source media */
132
+ readonly SourceMedia: "SOURCEMEDIA";
133
+ };
134
+ /**
135
+ * Type representing all valid tag property names
136
+ */
137
+ export type TagName = typeof Tags[keyof typeof Tags];
138
+ /**
139
+ * Type guard to check if a string is a valid tag name
140
+ */
141
+ export declare function isValidTagName(name: string): name is TagName;
142
+ /**
143
+ * Get all available tag names as an array
144
+ */
145
+ export declare function getAllTagNames(): readonly TagName[];
146
+ /**
147
+ * Format-specific tag mappings (for reference only - TagLib handles these automatically)
148
+ * This shows how standard property names map to format-specific identifiers.
149
+ */
150
+ export declare const FormatMappings: {
151
+ readonly Title: {
152
+ readonly id3v2: "TIT2";
153
+ readonly mp4: "©nam";
154
+ readonly vorbis: "TITLE";
155
+ readonly ape: "Title";
156
+ readonly riff: "INAM";
157
+ };
158
+ readonly Artist: {
159
+ readonly id3v2: "TPE1";
160
+ readonly mp4: "©ART";
161
+ readonly vorbis: "ARTIST";
162
+ readonly ape: "Artist";
163
+ readonly riff: "IART";
164
+ };
165
+ readonly Album: {
166
+ readonly id3v2: "TALB";
167
+ readonly mp4: "©alb";
168
+ readonly vorbis: "ALBUM";
169
+ readonly ape: "Album";
170
+ readonly riff: "IPRD";
171
+ };
172
+ readonly Date: {
173
+ readonly id3v2: "TDRC";
174
+ readonly mp4: "©day";
175
+ readonly vorbis: "DATE";
176
+ readonly ape: "Year";
177
+ readonly riff: "ICRD";
178
+ };
179
+ readonly Genre: {
180
+ readonly id3v2: "TCON";
181
+ readonly mp4: "©gen";
182
+ readonly vorbis: "GENRE";
183
+ readonly ape: "Genre";
184
+ readonly riff: "IGNR";
185
+ };
186
+ readonly Comment: {
187
+ readonly id3v2: "COMM";
188
+ readonly mp4: "©cmt";
189
+ readonly vorbis: "COMMENT";
190
+ readonly ape: "Comment";
191
+ readonly riff: "ICMT";
192
+ };
193
+ readonly TrackNumber: {
194
+ readonly id3v2: "TRCK";
195
+ readonly mp4: "trkn";
196
+ readonly vorbis: "TRACKNUMBER";
197
+ readonly ape: "Track";
198
+ readonly riff: "ITRK";
199
+ };
200
+ };
201
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI;IAEf,uBAAuB;;IAEvB,2BAA2B;;IAE3B,4BAA4B;;IAE5B,+BAA+B;;IAE/B,4BAA4B;;IAE5B,oBAAoB;;IAEpB,qBAAqB;;IAIrB,8BAA8B;;IAE9B,2BAA2B;;IAE3B,4BAA4B;;IAE5B,+BAA+B;;IAE/B,sCAAsC;;IAEtC,uBAAuB;;IAEvB,4BAA4B;;IAE5B,gBAAgB;;IAEhB,yBAAyB;;IAEzB,gCAAgC;;IAEhC,gBAAgB;;IAEhB,sBAAsB;;IAEtB,mCAAmC;;IAEnC,0BAA0B;;IAE1B,eAAe;;IAEf,qBAAqB;;IAErB,oBAAoB;;IAIpB,0BAA0B;;IAE1B,2BAA2B;;IAE3B,iCAAiC;;IAEjC,0BAA0B;;IAE1B,6BAA6B;;IAI7B,4CAA4C;;IAE5C,4CAA4C;;IAE5C,qBAAqB;;IAErB,wBAAwB;;IAIxB,4BAA4B;;IAE5B,oCAAoC;;IAEpC,0BAA0B;;IAE1B,6BAA6B;;IAE7B,+BAA+B;;IAE/B,yDAAyD;;IAEzD,mCAAmC;;IAEnC,mCAAmC;;IAInC,yBAAyB;;IAEzB,kBAAkB;;IAIlB,yBAAyB;;IAEzB,gBAAgB;;IAIhB,qBAAqB;;IAErB,8BAA8B;;IAE9B,8BAA8B;;IAE9B,8BAA8B;;IAE9B,8BAA8B;;IAI9B,iCAAiC;;IAEjC,qBAAqB;;IAErB,4BAA4B;;IAE5B,4BAA4B;;IAE5B,2BAA2B;;IAI3B,gCAAgC;;IAEhC,mBAAmB;;CAEX,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,OAAO,IAAI,CAAC,CAAC;AAErD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,OAAO,CAE5D;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,SAAS,OAAO,EAAE,CAEnD;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDjB,CAAC"}