taglib-wasm 1.0.0-beta.4 → 1.0.0-beta.6

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 (247) hide show
  1. package/dist/index.d.ts +10 -157
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +20 -57
  4. package/dist/src/deno-compile.d.ts +1 -6
  5. package/dist/src/deno-compile.d.ts.map +1 -1
  6. package/dist/src/deno-compile.js +28 -18
  7. package/dist/src/errors/base.d.ts +2 -2
  8. package/dist/src/errors/base.d.ts.map +1 -1
  9. package/dist/src/errors/classes.d.ts +8 -8
  10. package/dist/src/errors/classes.d.ts.map +1 -1
  11. package/dist/src/file-utils/copy-and-find.d.ts +44 -0
  12. package/dist/src/file-utils/copy-and-find.d.ts.map +1 -0
  13. package/dist/src/file-utils/copy-and-find.js +90 -0
  14. package/dist/src/file-utils/export-operations.d.ts +60 -0
  15. package/dist/src/file-utils/export-operations.d.ts.map +1 -0
  16. package/dist/src/file-utils/export-operations.js +42 -0
  17. package/dist/src/file-utils/import-operations.d.ts +86 -0
  18. package/dist/src/file-utils/import-operations.d.ts.map +1 -0
  19. package/dist/src/file-utils/import-operations.js +42 -0
  20. package/dist/src/file-utils/index.d.ts +5 -0
  21. package/dist/src/file-utils/index.d.ts.map +1 -0
  22. package/dist/src/file-utils/index.js +26 -0
  23. package/dist/src/file-utils/mime-detection.d.ts +5 -0
  24. package/dist/src/file-utils/mime-detection.d.ts.map +1 -0
  25. package/dist/src/file-utils/mime-detection.js +44 -0
  26. package/dist/src/folder-api/directory-walker.d.ts +6 -0
  27. package/dist/src/folder-api/directory-walker.d.ts.map +1 -0
  28. package/dist/src/folder-api/directory-walker.js +74 -0
  29. package/dist/src/folder-api/file-processors.d.ts +14 -0
  30. package/dist/src/folder-api/file-processors.d.ts.map +1 -0
  31. package/dist/src/folder-api/file-processors.js +101 -0
  32. package/dist/src/folder-api/folder-operations.d.ts +54 -0
  33. package/dist/src/folder-api/folder-operations.d.ts.map +1 -0
  34. package/dist/src/folder-api/folder-operations.js +83 -0
  35. package/dist/src/folder-api/index.d.ts +8 -0
  36. package/dist/src/folder-api/index.d.ts.map +1 -0
  37. package/dist/src/folder-api/index.js +12 -0
  38. package/dist/src/folder-api/scan-operations.d.ts +23 -0
  39. package/dist/src/folder-api/scan-operations.d.ts.map +1 -0
  40. package/dist/src/folder-api/scan-operations.js +137 -0
  41. package/dist/src/{folder-api.d.ts → folder-api/types.d.ts} +27 -82
  42. package/dist/src/folder-api/types.d.ts.map +1 -0
  43. package/dist/src/folder-api/types.js +30 -0
  44. package/dist/src/mod.d.ts +3 -4
  45. package/dist/src/mod.d.ts.map +1 -1
  46. package/dist/src/mod.js +1 -1
  47. package/dist/src/msgpack/decoder.d.ts +3 -41
  48. package/dist/src/msgpack/decoder.d.ts.map +1 -1
  49. package/dist/src/msgpack/decoder.js +34 -55
  50. package/dist/src/msgpack/encoder.d.ts +1 -49
  51. package/dist/src/msgpack/encoder.d.ts.map +1 -1
  52. package/dist/src/msgpack/encoder.js +43 -69
  53. package/dist/src/msgpack/index.d.ts +2 -107
  54. package/dist/src/msgpack/index.d.ts.map +1 -1
  55. package/dist/src/msgpack/index.js +6 -189
  56. package/dist/src/msgpack/processor.d.ts +37 -0
  57. package/dist/src/msgpack/processor.d.ts.map +1 -0
  58. package/dist/src/msgpack/processor.js +69 -0
  59. package/dist/src/msgpack/types.d.ts +2 -133
  60. package/dist/src/msgpack/types.d.ts.map +1 -1
  61. package/dist/src/msgpack/types.js +0 -7
  62. package/dist/src/msgpack/utils.d.ts +55 -0
  63. package/dist/src/msgpack/utils.d.ts.map +1 -0
  64. package/dist/src/msgpack/utils.js +128 -0
  65. package/dist/src/runtime/deno-detect.d.ts +8 -0
  66. package/dist/src/runtime/deno-detect.d.ts.map +1 -0
  67. package/dist/src/runtime/deno-detect.js +6 -0
  68. package/dist/src/runtime/detector.d.ts +3 -49
  69. package/dist/src/runtime/detector.d.ts.map +1 -1
  70. package/dist/src/runtime/detector.js +1 -5
  71. package/dist/src/runtime/length-prefix-protocol.d.ts +34 -0
  72. package/dist/src/runtime/length-prefix-protocol.d.ts.map +1 -0
  73. package/dist/src/runtime/length-prefix-protocol.js +49 -0
  74. package/dist/src/runtime/module-loader.d.ts +44 -0
  75. package/dist/src/runtime/module-loader.d.ts.map +1 -0
  76. package/dist/src/runtime/module-loader.js +85 -0
  77. package/dist/src/runtime/unified-loader/index.d.ts +5 -0
  78. package/dist/src/runtime/unified-loader/index.d.ts.map +1 -0
  79. package/dist/src/runtime/unified-loader/index.js +10 -0
  80. package/dist/src/runtime/unified-loader/loader.d.ts +3 -0
  81. package/dist/src/runtime/unified-loader/loader.d.ts.map +1 -0
  82. package/dist/src/runtime/unified-loader/loader.js +72 -0
  83. package/dist/src/runtime/unified-loader/module-loading.d.ts +4 -0
  84. package/dist/src/runtime/unified-loader/module-loading.d.ts.map +1 -0
  85. package/dist/src/runtime/unified-loader/module-loading.js +84 -0
  86. package/dist/src/runtime/unified-loader/module-selection.d.ts +6 -0
  87. package/dist/src/runtime/unified-loader/module-selection.d.ts.map +1 -0
  88. package/dist/src/runtime/unified-loader/module-selection.js +41 -0
  89. package/dist/src/runtime/{unified-loader.d.ts → unified-loader/types.d.ts} +9 -37
  90. package/dist/src/runtime/unified-loader/types.d.ts.map +1 -0
  91. package/dist/src/runtime/unified-loader/types.js +24 -0
  92. package/dist/src/runtime/{wasi-adapter.d.ts → wasi-adapter/adapter.d.ts} +11 -14
  93. package/dist/src/runtime/wasi-adapter/adapter.d.ts.map +1 -0
  94. package/dist/src/runtime/wasi-adapter/adapter.js +125 -0
  95. package/dist/src/runtime/wasi-adapter/file-handle.d.ts +47 -0
  96. package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +1 -0
  97. package/dist/src/runtime/wasi-adapter/file-handle.js +197 -0
  98. package/dist/src/runtime/wasi-adapter/index.d.ts +2 -0
  99. package/dist/src/runtime/wasi-adapter/index.d.ts.map +1 -0
  100. package/dist/src/runtime/wasi-adapter/index.js +4 -0
  101. package/dist/src/runtime/wasi-adapter/wasm-io.d.ts +11 -0
  102. package/dist/src/runtime/wasi-adapter/wasm-io.d.ts.map +1 -0
  103. package/dist/src/runtime/wasi-adapter/wasm-io.js +137 -0
  104. package/dist/src/runtime/wasi-fs-node.d.ts.map +1 -1
  105. package/dist/src/runtime/wasi-fs-node.js +7 -1
  106. package/dist/src/runtime/wasi-host-loader.d.ts +1 -1
  107. package/dist/src/runtime/wasi-host-loader.d.ts.map +1 -1
  108. package/dist/src/runtime/wasi-host.d.ts +0 -6
  109. package/dist/src/runtime/wasi-host.d.ts.map +1 -1
  110. package/dist/src/runtime/wasi-host.js +5 -10
  111. package/dist/src/runtime/wasi-memory.d.ts.map +1 -1
  112. package/dist/src/runtime/wasi-memory.js +19 -6
  113. package/dist/src/runtime/wasmer-sdk-loader/high-level-api.d.ts +10 -0
  114. package/dist/src/runtime/wasmer-sdk-loader/high-level-api.d.ts.map +1 -0
  115. package/dist/src/runtime/wasmer-sdk-loader/high-level-api.js +94 -0
  116. package/dist/src/runtime/wasmer-sdk-loader/index.d.ts +6 -0
  117. package/dist/src/runtime/wasmer-sdk-loader/index.d.ts.map +1 -0
  118. package/dist/src/runtime/wasmer-sdk-loader/index.js +17 -0
  119. package/dist/src/runtime/wasmer-sdk-loader/initialization.d.ts +16 -0
  120. package/dist/src/runtime/wasmer-sdk-loader/initialization.d.ts.map +1 -0
  121. package/dist/src/runtime/wasmer-sdk-loader/initialization.js +52 -0
  122. package/dist/src/runtime/wasmer-sdk-loader/loader.d.ts +9 -0
  123. package/dist/src/runtime/wasmer-sdk-loader/loader.d.ts.map +1 -0
  124. package/dist/src/runtime/wasmer-sdk-loader/loader.js +42 -0
  125. package/dist/src/runtime/wasmer-sdk-loader/module-creation.d.ts +9 -0
  126. package/dist/src/runtime/wasmer-sdk-loader/module-creation.d.ts.map +1 -0
  127. package/dist/src/runtime/wasmer-sdk-loader/module-creation.js +71 -0
  128. package/dist/src/runtime/{wasmer-sdk-loader.d.ts → wasmer-sdk-loader/types.d.ts} +3 -24
  129. package/dist/src/runtime/wasmer-sdk-loader/types.d.ts.map +1 -0
  130. package/dist/src/runtime/wasmer-sdk-loader/types.js +29 -0
  131. package/dist/src/runtime/wasmer-sdk-loader/wasi-stubs.d.ts +16 -0
  132. package/dist/src/runtime/wasmer-sdk-loader/wasi-stubs.d.ts.map +1 -0
  133. package/dist/src/runtime/wasmer-sdk-loader/wasi-stubs.js +64 -0
  134. package/dist/src/runtime/wasmtime-sidecar.d.ts.map +1 -1
  135. package/dist/src/runtime/wasmtime-sidecar.js +26 -60
  136. package/dist/src/simple/batch-operations.d.ts +36 -0
  137. package/dist/src/simple/batch-operations.d.ts.map +1 -0
  138. package/dist/src/simple/batch-operations.js +80 -0
  139. package/dist/src/simple/config.d.ts +12 -0
  140. package/dist/src/simple/config.d.ts.map +1 -0
  141. package/dist/src/simple/config.js +58 -0
  142. package/dist/src/simple/field-constants.d.ts +11 -0
  143. package/dist/src/simple/field-constants.d.ts.map +1 -0
  144. package/dist/src/simple/field-constants.js +22 -0
  145. package/dist/src/simple/index.d.ts +9 -0
  146. package/dist/src/simple/index.d.ts.map +1 -0
  147. package/dist/src/simple/index.js +87 -0
  148. package/dist/src/simple/picture-operations.d.ts +16 -0
  149. package/dist/src/simple/picture-operations.d.ts.map +1 -0
  150. package/dist/src/simple/picture-operations.js +124 -0
  151. package/dist/src/simple/tag-operations.d.ts +13 -0
  152. package/dist/src/simple/tag-operations.d.ts.map +1 -0
  153. package/dist/src/simple/tag-operations.js +164 -0
  154. package/dist/src/taglib/audio-file-base.d.ts +4 -3
  155. package/dist/src/taglib/audio-file-base.d.ts.map +1 -1
  156. package/dist/src/taglib/audio-file-base.js +19 -15
  157. package/dist/src/taglib/audio-file-impl.d.ts +2 -2
  158. package/dist/src/taglib/audio-file-impl.d.ts.map +1 -1
  159. package/dist/src/taglib/audio-file-impl.js +49 -39
  160. package/dist/src/taglib/taglib-class.d.ts +1 -1
  161. package/dist/src/taglib/taglib-class.d.ts.map +1 -1
  162. package/dist/src/taglib/taglib-class.js +28 -17
  163. package/dist/src/types/metadata-mappings.d.ts +1 -1
  164. package/dist/src/types/metadata-mappings.d.ts.map +1 -1
  165. package/dist/src/types/tags.d.ts +8 -0
  166. package/dist/src/types/tags.d.ts.map +1 -1
  167. package/dist/src/utils/file.d.ts +2 -27
  168. package/dist/src/utils/file.d.ts.map +1 -1
  169. package/dist/src/utils/file.js +27 -47
  170. package/dist/src/wasm.d.ts +7 -5
  171. package/dist/src/wasm.d.ts.map +1 -1
  172. package/dist/src/web-utils/canvas.d.ts +70 -0
  173. package/dist/src/web-utils/canvas.d.ts.map +1 -0
  174. package/dist/src/web-utils/canvas.js +57 -0
  175. package/dist/src/web-utils/data-url.d.ts +32 -0
  176. package/dist/src/web-utils/data-url.d.ts.map +1 -0
  177. package/dist/src/web-utils/data-url.js +29 -0
  178. package/dist/src/web-utils/dom-integration.d.ts +59 -0
  179. package/dist/src/web-utils/dom-integration.d.ts.map +1 -0
  180. package/dist/src/web-utils/dom-integration.js +53 -0
  181. package/dist/src/web-utils/index.d.ts +26 -0
  182. package/dist/src/web-utils/index.d.ts.map +1 -0
  183. package/dist/src/web-utils/index.js +21 -0
  184. package/dist/src/worker-pool/global-pool.d.ts +21 -0
  185. package/dist/src/worker-pool/global-pool.d.ts.map +1 -0
  186. package/dist/src/worker-pool/global-pool.js +22 -0
  187. package/dist/src/worker-pool/index.d.ts +10 -0
  188. package/dist/src/worker-pool/index.d.ts.map +1 -0
  189. package/dist/src/worker-pool/index.js +12 -0
  190. package/dist/src/worker-pool/pool-initialization.d.ts +7 -0
  191. package/dist/src/worker-pool/pool-initialization.d.ts.map +1 -0
  192. package/dist/src/worker-pool/pool-initialization.js +67 -0
  193. package/dist/src/worker-pool/pool.d.ts +39 -0
  194. package/dist/src/worker-pool/pool.d.ts.map +1 -0
  195. package/dist/src/{worker-pool.js → worker-pool/pool.js} +20 -142
  196. package/dist/src/worker-pool/types.d.ts +72 -0
  197. package/dist/src/worker-pool/types.d.ts.map +1 -0
  198. package/dist/src/workers/audio-file-workers.d.ts +85 -0
  199. package/dist/src/workers/audio-file-workers.d.ts.map +1 -0
  200. package/dist/src/{workers.js → workers/audio-file-workers.js} +13 -162
  201. package/dist/src/workers/batch-handler.d.ts +17 -0
  202. package/dist/src/workers/batch-handler.d.ts.map +1 -0
  203. package/dist/src/workers/batch-handler.js +82 -0
  204. package/dist/src/workers/index.d.ts +12 -0
  205. package/dist/src/workers/index.d.ts.map +1 -0
  206. package/dist/src/workers/index.js +7 -0
  207. package/dist/src/workers/taglib-worker.d.ts +0 -6
  208. package/dist/src/workers/taglib-worker.d.ts.map +1 -1
  209. package/dist/src/workers/taglib-worker.js +6 -86
  210. package/dist/src/workers/taglib-workers.d.ts +95 -0
  211. package/dist/src/workers/taglib-workers.d.ts.map +1 -0
  212. package/dist/src/workers/taglib-workers.js +173 -0
  213. package/dist/taglib-web.wasm +0 -0
  214. package/dist/taglib-wrapper.js +1 -1
  215. package/package.json +7 -7
  216. package/dist/src/deno-compile-loader.d.ts +0 -28
  217. package/dist/src/deno-compile-loader.d.ts.map +0 -1
  218. package/dist/src/deno-compile-loader.js +0 -42
  219. package/dist/src/deno-compile-support.d.ts +0 -51
  220. package/dist/src/deno-compile-support.d.ts.map +0 -1
  221. package/dist/src/deno-compile-support.js +0 -52
  222. package/dist/src/file-utils.d.ts +0 -204
  223. package/dist/src/file-utils.d.ts.map +0 -1
  224. package/dist/src/file-utils.js +0 -215
  225. package/dist/src/folder-api.d.ts.map +0 -1
  226. package/dist/src/folder-api.js +0 -391
  227. package/dist/src/runtime/unified-loader.d.ts.map +0 -1
  228. package/dist/src/runtime/unified-loader.js +0 -209
  229. package/dist/src/runtime/wasi-adapter.d.ts.map +0 -1
  230. package/dist/src/runtime/wasi-adapter.js +0 -454
  231. package/dist/src/runtime/wasi-loader.d.ts +0 -106
  232. package/dist/src/runtime/wasi-loader.d.ts.map +0 -1
  233. package/dist/src/runtime/wasi-loader.js +0 -231
  234. package/dist/src/runtime/wasmer-sdk-loader.d.ts.map +0 -1
  235. package/dist/src/runtime/wasmer-sdk-loader.js +0 -327
  236. package/dist/src/runtime/wasmer-types.d.js +0 -0
  237. package/dist/src/simple.d.ts +0 -530
  238. package/dist/src/simple.d.ts.map +0 -1
  239. package/dist/src/simple.js +0 -530
  240. package/dist/src/web-utils.d.ts +0 -179
  241. package/dist/src/web-utils.d.ts.map +0 -1
  242. package/dist/src/web-utils.js +0 -131
  243. package/dist/src/worker-pool.d.ts +0 -181
  244. package/dist/src/worker-pool.d.ts.map +0 -1
  245. package/dist/src/workers.d.ts +0 -219
  246. package/dist/src/workers.d.ts.map +0 -1
  247. /package/dist/src/{global.d.js → worker-pool/types.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -32,173 +32,26 @@
32
32
  * });
33
33
  * ```
34
34
  */
35
- /**
36
- * Full API exports for advanced usage with full control.
37
- * @see {@link TagLib} - Main TagLib class
38
- * @see {@link AudioFile} - Audio file interface
39
- */
40
35
  export { AudioFileImpl as AudioFile, TagLib } from "./src/taglib.ts";
41
36
  export type { MutableTag } 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
- * @see {@link WorkerError} - Worker pool operation failures
53
- * @see {@link SidecarError} - Sidecar process failures
54
- */
55
37
  export { EnvironmentError, FileOperationError, InvalidFormatError, isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isSidecarError, isTagLibError, isUnsupportedFormatError, isWorkerError, MemoryError, MetadataError, SidecarError, SUPPORTED_FORMATS, TagLibError, TagLibInitializationError, UnsupportedFormatError, WorkerError, } from "./src/errors.ts";
56
38
  export type { TagLibErrorCode } from "./src/errors.ts";
57
- /**
58
- * Simple API exports for easy tag reading and writing.
59
- * @see {@link readTags} - Read metadata from audio files
60
- * @see {@link applyTags} - Apply metadata changes and return modified buffer
61
- * @see {@link updateTags} - Update metadata and save to disk
62
- * @see {@link readProperties} - Read audio properties
63
- * @see {@link readPictures} - Read cover art/pictures
64
- * @see {@link applyPictures} - Apply pictures to audio files
65
- * @see {@link readCoverArt} - Read primary cover art data
66
- * @see {@link applyCoverArt} - Apply primary cover art
67
- * @see {@link readTagsBatch} - Read tags from multiple files efficiently
68
- * @see {@link readPropertiesBatch} - Read properties from multiple files efficiently
69
- * @see {@link readMetadataBatch} - Read complete metadata from multiple files efficiently
70
- * @see {@link setWorkerPoolMode} - Enable/disable worker pool for Simple API
71
- */
72
- export { addPicture, applyCoverArt, applyPictures, applyTags, type BatchOptions, type BatchResult, clearPictures, clearTags, findPictureByType, isValidAudioFile, readCoverArt, readFormat, readMetadataBatch, readPictureMetadata, readPictures, readProperties, readPropertiesBatch, readTags, readTagsBatch, replacePictureByType, setBufferMode, setSidecarConfig, setWorkerPoolMode, updateTags, } from "./src/simple.ts";
73
- /**
74
- * Enhanced property constants and utilities with rich metadata.
75
- * @see {@link PROPERTIES} - Comprehensive property definitions with metadata
76
- * @see {@link PropertyKey} - Type-safe property keys
77
- * @see {@link PropertyValue} - Type-safe property values
78
- * @see {@link isValidProperty} - Validate property keys
79
- * @see {@link getPropertyMetadata} - Get property metadata
80
- * @see {@link getAllPropertyKeys} - Get all valid property keys
81
- * @see {@link getPropertiesByFormat} - Filter properties by format support
82
- * @see {@link Tags} - Legacy tag name constants (deprecated)
83
- * @see {@link FormatMappings} - Format-specific field mappings (deprecated)
84
- */
39
+ export { initializeForDenoCompile, isDenoCompiled, prepareWasmForEmbedding, } from "./src/deno-compile.ts";
40
+ export { addPicture, applyCoverArt, applyPictures, applyTags, applyTagsToBuffer, type BatchOptions, type BatchResult, clearPictures, clearTags, findPictureByType, isValidAudioFile, readCoverArt, readFormat, readMetadataBatch, readPictureMetadata, readPictures, readProperties, readPropertiesBatch, readTags, readTagsBatch, replacePictureByType, setBufferMode, setSidecarConfig, setWorkerPoolMode, updateTags, writeTagsToFile, } from "./src/simple/index.ts";
85
41
  export { FormatMappings, getAllProperties, getAllPropertyKeys, getAllTagNames, getPropertiesByFormat, getPropertyMetadata, isValidProperty, isValidTagName, PROPERTIES, Tags, } from "./src/constants.ts";
86
42
  export type { PropertyMetadata } from "./src/constants/property-types.ts";
87
- /**
88
- * File I/O utilities for cover art operations.
89
- * @see {@link exportCoverArt} - Export cover art to file
90
- * @see {@link importCoverArt} - Import cover art from file
91
- * @see {@link copyCoverArt} - Copy cover art between files
92
- */
93
- export { copyCoverArt, exportAllPictures, exportCoverArt, exportPictureByType, findCoverArtFiles, importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile, } from "./src/file-utils.ts";
94
- /**
95
- * Folder/batch operations for processing multiple audio files.
96
- * @see {@link scanFolder} - Scan folder for audio files and read metadata
97
- * @see {@link updateFolderTags} - Update tags for multiple files
98
- * @see {@link findDuplicates} - Find duplicate files based on metadata
99
- * @see {@link exportFolderMetadata} - Export folder metadata to JSON
100
- */
101
- export { type AudioDynamics, type AudioFileMetadata, exportFolderMetadata, findDuplicates, type FolderScanOptions, type FolderScanResult, scanFolder, updateFolderTags, } from "./src/folder-api.ts";
102
- /**
103
- * Web browser utilities for cover art operations.
104
- * @see {@link pictureToDataURL} - Convert picture to data URL
105
- * @see {@link setCoverArtFromCanvas} - Set cover art from HTML canvas
106
- * @see {@link displayPicture} - Display picture in HTML img element
107
- */
108
- export { canvasToPicture, createPictureDownloadURL, createPictureGallery, dataURLToPicture, displayPicture, imageFileToPicture, pictureToDataURL, setCoverArtFromCanvas, } from "./src/web-utils.ts";
109
- /**
110
- * Type exports for TypeScript users.
111
- * These types define the structure of metadata, audio properties,
112
- * and configuration options used throughout the library.
113
- *
114
- * @see {@link Tag} - Basic metadata structure
115
- * @see {@link ExtendedTag} - Extended metadata with advanced fields
116
- * @see {@link AudioProperties} - Audio technical properties
117
- * @see {@link PropertyKey} - Type-safe property keys with autocomplete
118
- * @see {@link PropertyValue} - Type-safe property values
119
- */
120
- export type { AudioFileInput, AudioFormat, AudioProperties, ExtendedTag, FieldMapping, FileType, Picture, PropertyMap, Tag, TagName, } from "./src/types.ts";
121
- export type { PropertyKey, PropertyValue } from "./src/constants.ts";
122
- /**
123
- * Type and constant exports
124
- */
125
- export type { BitrateControlMode, OpenOptions, PictureType, } from "./src/types.ts";
43
+ export { copyCoverArt, exportAllPictures, exportCoverArt, exportPictureByType, findCoverArtFiles, importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile, } from "./src/file-utils/index.ts";
44
+ export { type AudioDynamics, type AudioFileMetadata, exportFolderMetadata, findDuplicates, type FolderScanOptions, type FolderScanResult, scanFolder, updateFolderTags, } from "./src/folder-api/index.ts";
45
+ export { canvasToPicture, createPictureDownloadURL, createPictureGallery, dataURLToPicture, displayPicture, imageFileToPicture, pictureToDataURL, setCoverArtFromCanvas, } from "./src/web-utils/index.ts";
46
+ export type { AudioFileInput, AudioFormat, AudioProperties, BitrateControlMode, ExtendedTag, FieldMapping, FileType, OpenOptions, Picture, PictureType, PropertyMap, Tag, TagName, } from "./src/types.ts";
126
47
  export { BITRATE_CONTROL_MODE_NAMES, BITRATE_CONTROL_MODE_VALUES, PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES, } from "./src/types.ts";
127
- /**
128
- * Complex property types and constants for structured metadata.
129
- * @see {@link COMPLEX_PROPERTIES} - Rich metadata object with format mappings
130
- * @see {@link COMPLEX_PROPERTY_KEY} - Simple key map for daily use
131
- * @see {@link Rating} - Track rating metadata (normalized 0.0-1.0)
132
- * @see {@link UnsyncedLyrics} - Unsynchronized lyrics text
133
- * @see {@link ComplexPropertyValueMap} - Type map for generic methods
134
- */
48
+ export type { PropertyKey, PropertyValue } from "./src/constants.ts";
135
49
  export { COMPLEX_PROPERTIES, COMPLEX_PROPERTY_KEY, } from "./src/constants/complex-properties.ts";
136
50
  export type { ComplexPropertyKey, ComplexPropertyKeyMap, ComplexPropertyValueMap, Rating, UnsyncedLyrics, VariantMap, } from "./src/constants/complex-properties.ts";
137
- /**
138
- * Rating conversion utilities for cross-format compatibility.
139
- * @see {@link RatingUtils} - Namespace with all rating utilities
140
- * @see {@link toNormalized} - POPM (0-255) to normalized (0.0-1.0)
141
- * @see {@link fromNormalized} - Normalized to POPM
142
- * @see {@link toStars} - Normalized to star rating
143
- * @see {@link fromStars} - Star rating to normalized
144
- * @see {@link toPopm} - Normalized to standard POPM value
145
- * @see {@link fromPopm} - Standard POPM to normalized
146
- */
147
51
  export { clamp as clampRating, fromNormalized, fromPercent, fromPopm, fromStars, isValid as isValidRating, RatingUtils, toNormalized, toPercent, toPopm, toStars, } from "./src/utils/rating.ts";
148
- /**
149
- * Worker pool exports for parallel processing.
150
- * @see {@link TagLibWorkerPool} - Worker pool for parallel file processing
151
- * @see {@link createWorkerPool} - Create and initialize a worker pool
152
- * @see {@link getGlobalWorkerPool} - Get/create global worker pool instance (deprecated)
153
- * @see {@link terminateGlobalWorkerPool} - Terminate global worker pool
154
- */
155
- export { createWorkerPool, getGlobalWorkerPool, TagLibWorkerPool, terminateGlobalWorkerPool, } from "./src/worker-pool.ts";
156
- export type { BatchOperation, WorkerPoolOptions, WorkerTask, } from "./src/worker-pool.ts";
157
- /**
158
- * Wasm module types for advanced usage.
159
- * @see {@link TagLibModule} - Full TagLib Wasm module interface
160
- * @see {@link WasmModule} - Base Emscripten module interface
161
- */
52
+ export { createWorkerPool, getGlobalWorkerPool, TagLibWorkerPool, terminateGlobalWorkerPool, } from "./src/worker-pool/index.ts";
53
+ export type { BatchOperation, WorkerPoolOptions, WorkerTask, } from "./src/worker-pool/index.ts";
162
54
  export type { TagLibModule, WasmModule } from "./src/wasm.ts";
163
- import type { TagLibModule } from "./src/wasm.ts";
164
- /**
165
- * Configuration options for loading the TagLib WASM module
166
- */
167
55
  export type { LoadTagLibOptions } from "./src/runtime/loader-types.ts";
168
- import type { LoadTagLibOptions } from "./src/runtime/loader-types.ts";
169
- /**
170
- * Load the TagLib Wasm module.
171
- * This function initializes the WebAssembly module and returns
172
- * the loaded module for use with the Full API.
173
- *
174
- * Automatically selects the optimal implementation:
175
- * - WASI for Deno/Node.js (faster filesystem access, MessagePack serialization)
176
- * - Emscripten for browsers (universal compatibility)
177
- *
178
- * @param options - Optional configuration for module initialization
179
- * @returns Promise resolving to the initialized TagLib module
180
- *
181
- * @example
182
- * ```typescript
183
- * import { loadTagLibModule, TagLib } from "taglib-wasm";
184
- *
185
- * // Auto-select optimal implementation
186
- * const module = await loadTagLibModule();
187
- * const taglib = new TagLib(module);
188
- *
189
- * // Force buffer mode (Emscripten-based in-memory I/O)
190
- * const module = await loadTagLibModule({ forceBufferMode: true });
191
- *
192
- * // Force WASI mode (Deno/Node.js only)
193
- * const module = await loadTagLibModule({ forceWasmType: "wasi" });
194
- *
195
- * // With custom WASM binary
196
- * const wasmData = await fetch("taglib.wasm").then(r => r.arrayBuffer());
197
- * const module = await loadTagLibModule({ wasmBinary: wasmData });
198
- * ```
199
- *
200
- * @note Most users should use `TagLib.initialize()` instead,
201
- * which handles module loading automatically.
202
- */
203
- export declare function loadTagLibModule(options?: LoadTagLibOptions): Promise<TagLibModule>;
56
+ export { loadTagLibModule } from "./src/runtime/module-loader.ts";
204
57
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;GAIG;AACH,OAAO,EAAE,aAAa,IAAI,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EA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B,GACpB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGrE,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,MAAM,EACN,cAAc,EACd,UAAU,GACX,MAAM,uCAAuC,CAAC;AAG/C,OAAO,EACL,KAAK,IAAI,WAAW,EACpB,cAAc,EACd,WAAW,EACX,QAAQ,EACR,SAAS,EACT,OAAO,IAAI,aAAa,EACxB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,MAAM,EACN,OAAO,GACR,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,UAAU,GACX,MAAM,4BAA4B,CAAC;AAGpC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
package/dist/index.js CHANGED
@@ -22,11 +22,17 @@ import {
22
22
  UnsupportedFormatError,
23
23
  WorkerError
24
24
  } from "./src/errors.js";
25
+ import {
26
+ initializeForDenoCompile,
27
+ isDenoCompiled,
28
+ prepareWasmForEmbedding
29
+ } from "./src/deno-compile.js";
25
30
  import {
26
31
  addPicture,
27
32
  applyCoverArt,
28
33
  applyPictures,
29
34
  applyTags,
35
+ applyTagsToBuffer,
30
36
  clearPictures,
31
37
  clearTags,
32
38
  findPictureByType,
@@ -44,8 +50,9 @@ import {
44
50
  setBufferMode,
45
51
  setSidecarConfig,
46
52
  setWorkerPoolMode,
47
- updateTags
48
- } from "./src/simple.js";
53
+ updateTags,
54
+ writeTagsToFile
55
+ } from "./src/simple/index.js";
49
56
  import {
50
57
  FormatMappings,
51
58
  getAllProperties,
@@ -68,13 +75,13 @@ import {
68
75
  importPictureWithType,
69
76
  loadPictureFromFile,
70
77
  savePictureToFile
71
- } from "./src/file-utils.js";
78
+ } from "./src/file-utils/index.js";
72
79
  import {
73
80
  exportFolderMetadata,
74
81
  findDuplicates,
75
82
  scanFolder,
76
83
  updateFolderTags
77
- } from "./src/folder-api.js";
84
+ } from "./src/folder-api/index.js";
78
85
  import {
79
86
  canvasToPicture,
80
87
  createPictureDownloadURL,
@@ -84,7 +91,7 @@ import {
84
91
  imageFileToPicture,
85
92
  pictureToDataURL,
86
93
  setCoverArtFromCanvas
87
- } from "./src/web-utils.js";
94
+ } from "./src/web-utils/index.js";
88
95
  import {
89
96
  BITRATE_CONTROL_MODE_NAMES,
90
97
  BITRATE_CONTROL_MODE_VALUES,
@@ -113,57 +120,8 @@ import {
113
120
  getGlobalWorkerPool,
114
121
  TagLibWorkerPool,
115
122
  terminateGlobalWorkerPool
116
- } from "./src/worker-pool.js";
117
- async function loadTagLibModule(options) {
118
- if (options?.forceBufferMode) {
119
- return loadBufferModeTagLibModule(options);
120
- }
121
- try {
122
- const { loadUnifiedTagLibModule } = await import("./src/runtime/unified-loader.js");
123
- return await loadUnifiedTagLibModule({
124
- wasmBinary: options?.wasmBinary,
125
- wasmUrl: options?.wasmUrl,
126
- forceWasmType: options?.forceWasmType,
127
- debug: false,
128
- useInlineWasm: false
129
- });
130
- } catch (error) {
131
- console.warn(
132
- `[TagLib] Unified loader failed, falling back to buffer mode: ${error}`
133
- );
134
- return loadBufferModeTagLibModule(options || {});
135
- }
136
- }
137
- async function loadBufferModeTagLibModule(options) {
138
- let createTagLibModule;
139
- try {
140
- const module2 = await import("./taglib-wrapper.js");
141
- createTagLibModule = module2.default;
142
- } catch {
143
- try {
144
- const module2 = await import("./dist/taglib-wrapper.js");
145
- createTagLibModule = module2.default;
146
- } catch {
147
- throw new Error(
148
- "Could not load taglib-wrapper.js from either ./build or ./dist"
149
- );
150
- }
151
- }
152
- const moduleConfig = {};
153
- if (options?.wasmBinary) {
154
- moduleConfig.wasmBinary = options.wasmBinary;
155
- }
156
- if (options?.wasmUrl) {
157
- moduleConfig.locateFile = (path) => {
158
- if (path.endsWith(".wasm")) {
159
- return options.wasmUrl;
160
- }
161
- return path;
162
- };
163
- }
164
- const module = await createTagLibModule(moduleConfig);
165
- return module;
166
- }
123
+ } from "./src/worker-pool/index.js";
124
+ import { loadTagLibModule } from "./src/runtime/module-loader.js";
167
125
  export {
168
126
  AudioFileImpl as AudioFile,
169
127
  BITRATE_CONTROL_MODE_NAMES,
@@ -193,6 +151,7 @@ export {
193
151
  applyCoverArt,
194
152
  applyPictures,
195
153
  applyTags,
154
+ applyTagsToBuffer,
196
155
  canvasToPicture,
197
156
  clamp as clampRating,
198
157
  clearPictures,
@@ -223,6 +182,8 @@ export {
223
182
  imageFileToPicture,
224
183
  importCoverArt,
225
184
  importPictureWithType,
185
+ initializeForDenoCompile,
186
+ isDenoCompiled,
226
187
  isEnvironmentError,
227
188
  isFileOperationError,
228
189
  isInvalidFormatError,
@@ -239,6 +200,7 @@ export {
239
200
  loadPictureFromFile,
240
201
  loadTagLibModule,
241
202
  pictureToDataURL,
203
+ prepareWasmForEmbedding,
242
204
  readCoverArt,
243
205
  readFormat,
244
206
  readMetadataBatch,
@@ -261,5 +223,6 @@ export {
261
223
  toPopm,
262
224
  toStars,
263
225
  updateFolderTags,
264
- updateTags
226
+ updateTags,
227
+ writeTagsToFile
265
228
  };
@@ -7,12 +7,7 @@
7
7
  * @module taglib-wasm/deno-compile
8
8
  */
9
9
  import { TagLib } from "./taglib.ts";
10
- /**
11
- * Detects if the code is running in a compiled Deno binary.
12
- *
13
- * @returns true if running in a Deno compiled binary, false otherwise
14
- */
15
- export declare function isDenoCompiled(): boolean;
10
+ export { isDenoCompiled } from "./runtime/deno-detect.ts";
16
11
  /**
17
12
  * Initialize TagLib with automatic handling for Deno compiled binaries.
18
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"deno-compile.d.ts","sourceRoot":"","sources":["../../src/deno-compile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAQxC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,wBAAwB,CAC5C,gBAAgB,SAAsB,GACrC,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,SAAsB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAyCf"}
1
+ {"version":3,"file":"deno-compile.d.ts","sourceRoot":"","sources":["../../src/deno-compile.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,wBAAwB,CAC5C,gBAAgB,SAAsB,GACrC,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,SAAsB,GAC/B,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
@@ -1,22 +1,26 @@
1
1
  import { TagLib } from "./taglib.js";
2
- function isDenoCompiled() {
3
- return typeof Deno !== "undefined" && // @ts-ignore: Deno global is only available in Deno runtime
4
- typeof Deno.mainModule === "string" && // @ts-ignore: Deno global is only available in Deno runtime
5
- Deno.mainModule.includes("deno-compile://");
6
- }
2
+ import { FileOperationError } from "./errors/classes.js";
3
+ import { isDenoCompiled } from "./runtime/deno-detect.js";
4
+ import { isDenoCompiled as isDenoCompiled2 } from "./runtime/deno-detect.js";
7
5
  async function initializeForDenoCompile(embeddedWasmPath = "./taglib-web.wasm") {
8
6
  if (isDenoCompiled()) {
9
- try {
10
- const wasmUrl = new URL(embeddedWasmPath, import.meta.url);
11
- const wasmBinary = await Deno.readFile(wasmUrl);
12
- return await TagLib.initialize({ wasmBinary, forceBufferMode: true });
13
- } catch (error) {
14
- console.warn(
15
- `Could not load embedded WASM from ${embeddedWasmPath}:`,
16
- error
17
- );
18
- console.warn("Falling back to network fetch (requires --allow-net)");
7
+ const strategies = [
8
+ // Relative to user's entry point (where --include embeds files)
9
+ () => Deno.readFile(new URL(embeddedWasmPath, Deno.mainModule)),
10
+ // Relative to this library module
11
+ () => Deno.readFile(new URL(embeddedWasmPath, import.meta.url)),
12
+ // CWD fallback (last resort — depends on where the binary is invoked)
13
+ () => Deno.readFile(embeddedWasmPath)
14
+ ];
15
+ for (const strategy of strategies) {
16
+ try {
17
+ const wasmBinary = await strategy();
18
+ return await TagLib.initialize({ wasmBinary, forceBufferMode: true });
19
+ } catch {
20
+ }
19
21
  }
22
+ console.warn(`Could not load embedded WASM from ${embeddedWasmPath}`);
23
+ console.warn("Falling back to network fetch (requires --allow-net)");
20
24
  }
21
25
  return await TagLib.initialize({ forceBufferMode: true });
22
26
  }
@@ -41,7 +45,10 @@ async function prepareWasmForEmbedding(outputPath = "./taglib-web.wasm") {
41
45
  }
42
46
  }
43
47
  if (!wasmData || !sourcePath) {
44
- throw new Error("Could not find taglib-web.wasm in expected locations");
48
+ throw new FileOperationError(
49
+ "read",
50
+ "Could not find taglib-web.wasm in expected locations"
51
+ );
45
52
  }
46
53
  await Deno.writeFile(outputPath, wasmData);
47
54
  console.log(`WASM file copied from ${sourcePath} to ${outputPath}`);
@@ -50,11 +57,14 @@ async function prepareWasmForEmbedding(outputPath = "./taglib-web.wasm") {
50
57
  );
51
58
  } catch (error) {
52
59
  const message = error instanceof Error ? error.message : String(error);
53
- throw new Error(`Failed to prepare WASM for embedding: ${message}`);
60
+ throw new FileOperationError(
61
+ "read",
62
+ `Failed to prepare WASM for embedding: ${message}`
63
+ );
54
64
  }
55
65
  }
56
66
  export {
57
67
  initializeForDenoCompile,
58
- isDenoCompiled,
68
+ isDenoCompiled2 as isDenoCompiled,
59
69
  prepareWasmForEmbedding
60
70
  };
@@ -11,13 +11,13 @@ export type TagLibErrorCode = "INITIALIZATION" | "INVALID_FORMAT" | "UNSUPPORTED
11
11
  */
12
12
  export declare class TagLibError extends Error {
13
13
  readonly code: TagLibErrorCode;
14
- readonly details?: Record<string, any> | undefined;
14
+ readonly details?: Record<string, unknown> | undefined;
15
15
  /**
16
16
  * Creates a new TagLibError
17
17
  * @param code - Error code for programmatic handling
18
18
  * @param message - Human-readable error message
19
19
  * @param details - Additional context about the error
20
20
  */
21
- constructor(code: TagLibErrorCode, message: string, details?: Record<string, any> | undefined);
21
+ constructor(code: TagLibErrorCode, message: string, details?: Record<string, unknown> | undefined);
22
22
  }
23
23
  //# sourceMappingURL=base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAOpB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,gBAAgB,GAChB,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,UAAU,GACV,QAAQ,GACR,aAAa,GACb,QAAQ,GACR,SAAS,CAAC;AAEd;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;aAQlB,IAAI,EAAE,eAAe;aAErB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAT/C;;;;;OAKG;gBAEe,IAAI,EAAE,eAAe,EACrC,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAA;CAMhD"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,sDAOpB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,gBAAgB,GAChB,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,UAAU,GACV,QAAQ,GACR,aAAa,GACb,QAAQ,GACR,SAAS,CAAC;AAEd;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;aAQlB,IAAI,EAAE,eAAe;aAErB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IATnD;;;;;OAKG;gBAEe,IAAI,EAAE,eAAe,EACrC,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAMpD"}
@@ -8,7 +8,7 @@ export declare class TagLibInitializationError extends TagLibError {
8
8
  * @param message - Description of the initialization failure
9
9
  * @param details - Additional context about the error
10
10
  */
11
- constructor(message: string, details?: Record<string, any>);
11
+ constructor(message: string, details?: Record<string, unknown>);
12
12
  }
13
13
  /**
14
14
  * Error thrown when an audio file format is invalid or corrupted
@@ -21,7 +21,7 @@ export declare class InvalidFormatError extends TagLibError {
21
21
  * @param bufferSize - Size of the audio buffer in bytes
22
22
  * @param details - Additional context about the error
23
23
  */
24
- constructor(message: string, bufferSize?: number | undefined, details?: Record<string, any>);
24
+ constructor(message: string, bufferSize?: number | undefined, details?: Record<string, unknown>);
25
25
  }
26
26
  /**
27
27
  * Error thrown when an audio format is recognized but not supported
@@ -35,7 +35,7 @@ export declare class UnsupportedFormatError extends TagLibError {
35
35
  * @param supportedFormats - List of formats that are supported
36
36
  * @param details - Additional context about the error
37
37
  */
38
- constructor(format: string, supportedFormats?: readonly string[], details?: Record<string, any>);
38
+ constructor(format: string, supportedFormats?: readonly string[], details?: Record<string, unknown>);
39
39
  }
40
40
  /**
41
41
  * Error thrown during file operations (read, write, save)
@@ -50,7 +50,7 @@ export declare class FileOperationError extends TagLibError {
50
50
  * @param path - File path involved in the operation
51
51
  * @param details - Additional context about the error
52
52
  */
53
- constructor(operation: "read" | "write" | "save" | "stat", message: string, path?: string | undefined, details?: Record<string, any>);
53
+ constructor(operation: "read" | "write" | "save" | "stat", message: string, path?: string | undefined, details?: Record<string, unknown>);
54
54
  }
55
55
  /**
56
56
  * Error thrown when metadata operations fail
@@ -65,7 +65,7 @@ export declare class MetadataError extends TagLibError {
65
65
  * @param field - The metadata field involved
66
66
  * @param details - Additional context about the error
67
67
  */
68
- constructor(operation: "read" | "write", message: string, field?: string | undefined, details?: Record<string, any>);
68
+ constructor(operation: "read" | "write", message: string, field?: string | undefined, details?: Record<string, unknown>);
69
69
  }
70
70
  /**
71
71
  * Error thrown when Wasm memory operations fail
@@ -76,7 +76,7 @@ export declare class MemoryError extends TagLibError {
76
76
  * @param message - Description of the memory failure
77
77
  * @param details - Additional context about the error
78
78
  */
79
- constructor(message: string, details?: Record<string, any>);
79
+ constructor(message: string, details?: Record<string, unknown>);
80
80
  }
81
81
  /**
82
82
  * Error thrown when the environment doesn't support required features
@@ -102,7 +102,7 @@ export declare class WorkerError extends TagLibError {
102
102
  * @param message - Description of the worker failure
103
103
  * @param details - Additional context about the error
104
104
  */
105
- constructor(message: string, details?: Record<string, any>);
105
+ constructor(message: string, details?: Record<string, unknown>);
106
106
  }
107
107
  /**
108
108
  * Error thrown when sidecar process operations fail
@@ -113,6 +113,6 @@ export declare class SidecarError extends TagLibError {
113
113
  * @param message - Description of the sidecar failure
114
114
  * @param details - Additional context about the error
115
115
  */
116
- constructor(message: string, details?: Record<string, any>);
116
+ constructor(message: string, details?: Record<string, unknown>);
117
117
  }
118
118
  //# sourceMappingURL=classes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"classes.d.ts","sourceRoot":"","sources":["../../../src/errors/classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,WAAW,EAAE,MAAM,WAAW,CAAC;AAY3D;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,WAAW;IACxD;;;;OAIG;g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AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAK/D;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAK/D"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copy cover art from one audio file to another
3
+ *
4
+ * @param sourcePath - Path to source audio file
5
+ * @param targetPath - Path to target audio file (modified in place)
6
+ * @param options - Copy options
7
+ * @returns Promise that resolves when cover art is copied
8
+ * @throws Error if source has no cover art
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Copy cover art from one file to another
13
+ * await copyCoverArt("album/track01.mp3", "album/track02.mp3");
14
+ *
15
+ * // Copy all pictures
16
+ * await copyCoverArt("source.mp3", "target.mp3", { copyAll: true });
17
+ * ```
18
+ */
19
+ export declare function copyCoverArt(sourcePath: string, targetPath: string, options?: {
20
+ copyAll?: boolean;
21
+ }): Promise<void>;
22
+ /**
23
+ * Check if cover art files exist for an audio file
24
+ *
25
+ * Looks for common cover art filenames in the same directory as the audio file.
26
+ *
27
+ * @param audioPath - Path to the audio file
28
+ * @returns Object with found cover art paths
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const covers = await findCoverArtFiles("music/album/track01.mp3");
33
+ * if (covers.front) {
34
+ * await importCoverArt("music/album/track01.mp3", covers.front);
35
+ * }
36
+ * ```
37
+ */
38
+ export declare function findCoverArtFiles(audioPath: string): Promise<{
39
+ front?: string;
40
+ back?: string;
41
+ folder?: string;
42
+ [key: string]: string | undefined;
43
+ }>;
44
+ //# sourceMappingURL=copy-and-find.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-and-find.d.ts","sourceRoot":"","sources":["../../../src/file-utils/copy-and-find.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,CA6Bf;AA2BD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC,CAAC,CAiCD"}