taglib-wasm 2.3.0 → 2.4.0

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 (635) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +72 -64
  3. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/assertClassBrand.js +7 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/checkPrivateRedeclaration.js +6 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldGet2.js +7 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldInitSpec.js +7 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldSet2.js +7 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js +12 -0
  9. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/toPrimitive.js +14 -0
  10. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/toPropertyKey.js +9 -0
  11. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/typeof.js +11 -0
  12. package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/usingCtx.js +57 -0
  13. package/dist/_virtual/_rolldown/runtime.js +13 -0
  14. package/dist/bwf/bext.d.ts.map +1 -0
  15. package/dist/bwf/bext.js +119 -0
  16. package/dist/{src/constants → constants}/additional-properties.d.ts.map +1 -1
  17. package/dist/constants/additional-properties.js +270 -0
  18. package/dist/constants/basic-properties.d.ts.map +1 -0
  19. package/dist/constants/basic-properties.js +128 -0
  20. package/dist/constants/complex-properties.d.ts.map +1 -0
  21. package/dist/constants/complex-properties.js +1 -0
  22. package/dist/constants/format-mappings.d.ts.map +1 -0
  23. package/dist/constants/format-mappings.js +58 -0
  24. package/dist/{src/constants → constants}/general-extended-properties.d.ts.map +1 -1
  25. package/dist/constants/general-extended-properties.js +272 -0
  26. package/dist/constants/index.d.ts.map +1 -0
  27. package/dist/constants/index.js +5 -0
  28. package/dist/constants/properties.d.ts +43 -0
  29. package/dist/constants/properties.d.ts.map +1 -0
  30. package/dist/constants/properties.js +105 -0
  31. package/dist/constants/property-types.d.ts.map +1 -0
  32. package/dist/constants/property-types.js +1 -0
  33. package/dist/{src/constants → constants}/specialized-properties.d.ts.map +1 -1
  34. package/dist/constants/specialized-properties.js +335 -0
  35. package/dist/{src/constants → constants}/utilities.d.ts +1 -1
  36. package/dist/constants/utilities.d.ts.map +1 -0
  37. package/dist/constants/utilities.js +50 -0
  38. package/dist/constants.d.ts.map +1 -0
  39. package/dist/constants.js +5 -0
  40. package/dist/{src/deno-compile.d.ts → deno-compile.d.ts} +8 -2
  41. package/dist/deno-compile.d.ts.map +1 -0
  42. package/dist/deno-compile.js +113 -0
  43. package/dist/disc-folder.d.ts +4 -4
  44. package/dist/disc-folder.d.ts.map +1 -1
  45. package/dist/disc-folder.js +596 -544
  46. package/dist/errors/base.d.ts.map +1 -0
  47. package/dist/errors/base.js +66 -0
  48. package/dist/errors/classes.d.ts.map +1 -0
  49. package/dist/errors/classes.js +164 -0
  50. package/dist/errors/guards.d.ts.map +1 -0
  51. package/dist/errors/guards.js +26 -0
  52. package/dist/errors/index.d.ts.map +1 -0
  53. package/dist/errors/index.js +4 -0
  54. package/dist/errors.d.ts.map +1 -0
  55. package/dist/errors.js +5 -0
  56. package/dist/file-utils/copy-and-find.d.ts.map +1 -0
  57. package/dist/file-utils/copy-and-find.js +107 -0
  58. package/dist/file-utils/export-operations.d.ts.map +1 -0
  59. package/dist/file-utils/export-operations.js +84 -0
  60. package/dist/file-utils/import-operations.d.ts.map +1 -0
  61. package/dist/file-utils/import-operations.js +109 -0
  62. package/dist/file-utils/index.d.ts.map +1 -0
  63. package/dist/file-utils/index.js +5 -0
  64. package/dist/file-utils/mime-detection.d.ts.map +1 -0
  65. package/dist/file-utils/mime-detection.js +44 -0
  66. package/dist/folder-api/album-corroborate.d.ts.map +1 -0
  67. package/dist/folder-api/album-corroborate.js +35 -0
  68. package/dist/folder-api/album-discs.d.ts.map +1 -0
  69. package/dist/folder-api/album-discs.js +119 -0
  70. package/dist/folder-api/album-grouping.d.ts.map +1 -0
  71. package/dist/folder-api/album-grouping.js +161 -0
  72. package/dist/folder-api/album-identity.d.ts.map +1 -0
  73. package/dist/folder-api/album-identity.js +165 -0
  74. package/dist/folder-api/album-types.d.ts.map +1 -0
  75. package/dist/folder-api/album-types.js +1 -0
  76. package/dist/folder-api/directory-walker.d.ts.map +1 -0
  77. package/dist/folder-api/directory-walker.js +27 -0
  78. package/dist/folder-api/file-processors.d.ts.map +1 -0
  79. package/dist/folder-api/file-processors.js +52 -0
  80. package/dist/folder-api/folder-disc.d.ts.map +1 -0
  81. package/dist/folder-api/folder-disc.js +166 -0
  82. package/dist/folder-api/folder-operations.d.ts.map +1 -0
  83. package/dist/folder-api/folder-operations.js +69 -0
  84. package/dist/folder-api/index.d.ts.map +1 -0
  85. package/dist/{src/folder-api → folder-api}/index.js +1 -8
  86. package/dist/folder-api/scan-for-albums.d.ts.map +1 -0
  87. package/dist/folder-api/scan-for-albums.js +25 -0
  88. package/dist/folder-api/scan-operations.d.ts.map +1 -0
  89. package/dist/folder-api/scan-operations.js +79 -0
  90. package/dist/folder-api/types.d.ts.map +1 -0
  91. package/dist/folder-api/types.js +21 -0
  92. package/dist/folder.d.ts +1 -1
  93. package/dist/folder.d.ts.map +1 -1
  94. package/dist/folder.js +7 -2
  95. package/dist/global.d.js +1 -0
  96. package/dist/index.browser.d.ts +29 -30
  97. package/dist/index.browser.d.ts.map +1 -1
  98. package/dist/index.browser.js +4106 -4479
  99. package/dist/index.d.ts +26 -26
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +40 -185
  102. package/dist/msgpack/decoder.d.ts.map +1 -0
  103. package/dist/msgpack/decoder.js +177 -0
  104. package/dist/msgpack/encoder.d.ts.map +1 -0
  105. package/dist/msgpack/encoder.js +211 -0
  106. package/dist/msgpack/index.d.ts.map +1 -0
  107. package/dist/msgpack/index.js +5 -0
  108. package/dist/{src/msgpack → msgpack}/types.d.ts +1 -1
  109. package/dist/msgpack/types.d.ts.map +1 -0
  110. package/dist/msgpack/types.js +13 -0
  111. package/dist/msgpack/utils.d.ts.map +1 -0
  112. package/dist/msgpack/utils.js +116 -0
  113. package/dist/rating.d.ts +1 -1
  114. package/dist/rating.d.ts.map +1 -1
  115. package/dist/rating.js +2 -2
  116. package/dist/runtime/deno-detect.d.ts +19 -0
  117. package/dist/runtime/deno-detect.d.ts.map +1 -0
  118. package/dist/runtime/deno-detect.js +26 -0
  119. package/dist/{src/runtime → runtime}/detector.d.ts +2 -0
  120. package/dist/runtime/detector.d.ts.map +1 -0
  121. package/dist/runtime/detector.js +173 -0
  122. package/dist/runtime/loader-types.d.ts.map +1 -0
  123. package/dist/runtime/loader-types.js +23 -0
  124. package/dist/runtime/module-loader-browser.d.ts.map +1 -0
  125. package/dist/runtime/module-loader-browser.js +33 -0
  126. package/dist/runtime/module-loader.d.ts.map +1 -0
  127. package/dist/runtime/module-loader.js +119 -0
  128. package/dist/runtime/platform-io.d.ts.map +1 -0
  129. package/dist/runtime/platform-io.js +168 -0
  130. package/dist/runtime/unified-loader/index.d.ts.map +1 -0
  131. package/dist/{src/runtime → runtime}/unified-loader/index.js +1 -7
  132. package/dist/runtime/unified-loader/loader.d.ts.map +1 -0
  133. package/dist/runtime/unified-loader/loader.js +64 -0
  134. package/dist/runtime/unified-loader/module-loading.d.ts.map +1 -0
  135. package/dist/runtime/unified-loader/module-loading.js +90 -0
  136. package/dist/runtime/unified-loader/module-selection.d.ts.map +1 -0
  137. package/dist/runtime/unified-loader/module-selection.js +25 -0
  138. package/dist/runtime/unified-loader/types.d.ts.map +1 -0
  139. package/dist/runtime/unified-loader/types.js +24 -0
  140. package/dist/runtime/wasi-adapter/adapter.d.ts.map +1 -0
  141. package/dist/runtime/wasi-adapter/adapter.js +114 -0
  142. package/dist/runtime/wasi-adapter/audio-properties.d.ts.map +1 -0
  143. package/dist/runtime/wasi-adapter/audio-properties.js +120 -0
  144. package/dist/runtime/wasi-adapter/file-handle.d.ts.map +1 -0
  145. package/dist/runtime/wasi-adapter/file-handle.js +181 -0
  146. package/dist/runtime/wasi-adapter/handle-state.d.ts.map +1 -0
  147. package/dist/runtime/wasi-adapter/handle-state.js +48 -0
  148. package/dist/runtime/wasi-adapter/index.d.ts.map +1 -0
  149. package/dist/{src/runtime → runtime}/wasi-adapter/index.js +1 -3
  150. package/dist/runtime/wasi-adapter/mp4-items.d.ts.map +1 -0
  151. package/dist/runtime/wasi-adapter/mp4-items.js +97 -0
  152. package/dist/runtime/wasi-adapter/path-open.d.ts.map +1 -0
  153. package/dist/runtime/wasi-adapter/path-open.js +101 -0
  154. package/dist/runtime/wasi-adapter/property-surface.d.ts.map +1 -0
  155. package/dist/runtime/wasi-adapter/property-surface.js +96 -0
  156. package/dist/runtime/wasi-adapter/structured-fields.d.ts.map +1 -0
  157. package/dist/runtime/wasi-adapter/structured-fields.js +144 -0
  158. package/dist/runtime/wasi-adapter/tag-keys.d.ts.map +1 -0
  159. package/dist/runtime/wasi-adapter/tag-keys.js +65 -0
  160. package/dist/runtime/wasi-adapter/wasm-io.d.ts.map +1 -0
  161. package/dist/runtime/wasi-adapter/wasm-io.js +154 -0
  162. package/dist/runtime/wasi-fs-deno.d.ts.map +1 -0
  163. package/dist/runtime/wasi-fs-deno.js +25 -0
  164. package/dist/runtime/wasi-fs-node.d.ts.map +1 -0
  165. package/dist/runtime/wasi-fs-node.js +58 -0
  166. package/dist/runtime/wasi-fs-provider.d.ts.map +1 -0
  167. package/dist/runtime/wasi-fs-provider.js +1 -0
  168. package/dist/runtime/wasi-host-loader.d.ts.map +1 -0
  169. package/dist/runtime/wasi-host-loader.js +101 -0
  170. package/dist/runtime/wasi-host.d.ts.map +1 -0
  171. package/dist/runtime/wasi-host.js +199 -0
  172. package/dist/runtime/wasi-memory.d.ts.map +1 -0
  173. package/dist/runtime/wasi-memory.js +179 -0
  174. package/dist/runtime/wasmer-sdk-loader/types.d.ts.map +1 -0
  175. package/dist/runtime/wasmer-sdk-loader/types.js +15 -0
  176. package/dist/simple/batch-operations.d.ts.map +1 -0
  177. package/dist/simple/batch-operations.js +245 -0
  178. package/dist/simple/checksum-operations.d.ts.map +1 -0
  179. package/dist/simple/checksum-operations.js +28 -0
  180. package/dist/simple/config.d.ts.map +1 -0
  181. package/dist/simple/config.js +17 -0
  182. package/dist/simple/index.d.ts.map +1 -0
  183. package/dist/simple/index.js +8 -0
  184. package/dist/simple/picture-operations.d.ts.map +1 -0
  185. package/dist/simple/picture-operations.js +132 -0
  186. package/dist/simple/tag-operations.d.ts.map +1 -0
  187. package/dist/simple/tag-operations.js +125 -0
  188. package/dist/simple/with-audio-file.d.ts.map +1 -0
  189. package/dist/simple/with-audio-file.js +28 -0
  190. package/dist/simple.browser.d.ts +2 -2
  191. package/dist/simple.browser.d.ts.map +1 -1
  192. package/dist/simple.browser.js +3405 -3692
  193. package/dist/simple.d.ts +1 -1
  194. package/dist/simple.d.ts.map +1 -1
  195. package/dist/simple.js +8 -2
  196. package/dist/taglib/audio-file-base.d.ts.map +1 -0
  197. package/dist/taglib/audio-file-base.js +166 -0
  198. package/dist/taglib/audio-file-bwf.d.ts.map +1 -0
  199. package/dist/taglib/audio-file-bwf.js +33 -0
  200. package/dist/taglib/audio-file-checksum.d.ts.map +1 -0
  201. package/dist/taglib/audio-file-checksum.js +90 -0
  202. package/dist/taglib/audio-file-impl.d.ts.map +1 -0
  203. package/dist/taglib/audio-file-impl.js +234 -0
  204. package/dist/taglib/audio-file-interface.d.ts.map +1 -0
  205. package/dist/taglib/audio-file-interface.js +1 -0
  206. package/dist/taglib/auto-dispose.d.ts.map +1 -0
  207. package/dist/taglib/auto-dispose.js +34 -0
  208. package/dist/taglib/embind-adapter.d.ts.map +1 -0
  209. package/dist/taglib/embind-adapter.js +138 -0
  210. package/dist/taglib/extra-state-registry.d.ts.map +1 -0
  211. package/dist/taglib/extra-state-registry.js +72 -0
  212. package/dist/{src/taglib → taglib}/id3v2-frames.d.ts +0 -1
  213. package/dist/taglib/id3v2-frames.d.ts.map +1 -0
  214. package/dist/taglib/id3v2-frames.js +25 -0
  215. package/dist/taglib/index.d.ts.map +1 -0
  216. package/dist/taglib/index.js +7 -0
  217. package/dist/taglib/load-audio-data.d.ts.map +1 -0
  218. package/dist/taglib/load-audio-data.js +54 -0
  219. package/dist/taglib/media-ranges.d.ts.map +1 -0
  220. package/dist/taglib/media-ranges.js +309 -0
  221. package/dist/taglib/metadata-extent.d.ts.map +1 -0
  222. package/dist/taglib/metadata-extent.js +394 -0
  223. package/dist/taglib/mp4-item-names.d.ts.map +1 -0
  224. package/dist/taglib/mp4-item-names.js +14 -0
  225. package/dist/taglib/mutable-tag-impl.d.ts.map +1 -0
  226. package/dist/taglib/mutable-tag-impl.js +81 -0
  227. package/dist/taglib/mutable-tag.d.ts.map +1 -0
  228. package/dist/taglib/mutable-tag.js +1 -0
  229. package/dist/taglib/save-reconstruct.d.ts.map +1 -0
  230. package/dist/taglib/save-reconstruct.js +53 -0
  231. package/dist/taglib/taglib-class.d.ts.map +1 -0
  232. package/dist/taglib/taglib-class.js +146 -0
  233. package/dist/taglib-wasi.wasm +0 -0
  234. package/dist/taglib.d.ts.map +1 -0
  235. package/dist/taglib.js +7 -0
  236. package/dist/{src/types → types}/audio-formats.d.ts +5 -1
  237. package/dist/types/audio-formats.d.ts.map +1 -0
  238. package/dist/types/audio-formats.js +6 -0
  239. package/dist/types/bwf.d.ts.map +1 -0
  240. package/dist/types/bwf.js +1 -0
  241. package/dist/types/chapters.d.ts.map +1 -0
  242. package/dist/types/chapters.js +1 -0
  243. package/dist/types/config.d.ts.map +1 -0
  244. package/dist/types/config.js +1 -0
  245. package/dist/types/format-property-keys.d.ts.map +1 -0
  246. package/dist/types/format-property-keys.js +1 -0
  247. package/dist/types/index.d.ts.map +1 -0
  248. package/dist/types/index.js +9 -0
  249. package/dist/types/metadata-mappings.d.ts.map +1 -0
  250. package/dist/types/metadata-mappings.js +323 -0
  251. package/dist/types/pictures.d.ts.map +1 -0
  252. package/dist/types/pictures.js +79 -0
  253. package/dist/types/tags.d.ts.map +1 -0
  254. package/dist/types/tags.js +1 -0
  255. package/dist/types.d.ts.map +1 -0
  256. package/dist/types.js +5 -0
  257. package/dist/utils/file.d.ts.map +1 -0
  258. package/dist/utils/file.js +43 -0
  259. package/dist/utils/mirror-fields.d.ts.map +1 -0
  260. package/dist/utils/mirror-fields.js +107 -0
  261. package/dist/utils/node-fs.d.ts.map +1 -0
  262. package/dist/utils/node-fs.js +36 -0
  263. package/dist/utils/path.d.ts.map +1 -0
  264. package/dist/utils/path.js +52 -0
  265. package/dist/utils/rating.d.ts.map +1 -0
  266. package/dist/utils/rating.js +150 -0
  267. package/dist/utils/tag-mapping.d.ts.map +1 -0
  268. package/dist/utils/tag-mapping.js +207 -0
  269. package/dist/utils/write.d.ts.map +1 -0
  270. package/dist/utils/write.js +18 -0
  271. package/dist/version.d.ts +2 -0
  272. package/dist/version.d.ts.map +1 -0
  273. package/dist/version.js +4 -0
  274. package/dist/wasm.d.ts.map +1 -0
  275. package/dist/wasm.js +1 -0
  276. package/dist/web-utils/canvas.d.ts.map +1 -0
  277. package/dist/web-utils/canvas.js +97 -0
  278. package/dist/web-utils/data-url.d.ts.map +1 -0
  279. package/dist/web-utils/data-url.js +54 -0
  280. package/dist/web-utils/dom-integration.d.ts.map +1 -0
  281. package/dist/web-utils/dom-integration.js +105 -0
  282. package/dist/web-utils/index.d.ts.map +1 -0
  283. package/dist/web-utils/index.js +4 -0
  284. package/dist/web.browser.d.ts +5 -5
  285. package/dist/web.browser.d.ts.map +1 -1
  286. package/dist/web.browser.js +3169 -3411
  287. package/dist/web.d.ts +1 -1
  288. package/dist/web.d.ts.map +1 -1
  289. package/dist/web.js +5 -2
  290. package/package.json +136 -100
  291. package/dist/src/bwf/bext.d.ts.map +0 -1
  292. package/dist/src/bwf/bext.js +0 -126
  293. package/dist/src/constants/additional-properties.js +0 -204
  294. package/dist/src/constants/basic-properties.d.ts.map +0 -1
  295. package/dist/src/constants/basic-properties.js +0 -89
  296. package/dist/src/constants/complex-properties.d.ts.map +0 -1
  297. package/dist/src/constants/complex-properties.js +0 -0
  298. package/dist/src/constants/format-mappings.d.ts.map +0 -1
  299. package/dist/src/constants/format-mappings.js +0 -54
  300. package/dist/src/constants/general-extended-properties.js +0 -254
  301. package/dist/src/constants/index.d.ts.map +0 -1
  302. package/dist/src/constants/index.js +0 -4
  303. package/dist/src/constants/properties.d.ts +0 -877
  304. package/dist/src/constants/properties.d.ts.map +0 -1
  305. package/dist/src/constants/properties.js +0 -95
  306. package/dist/src/constants/property-types.d.ts.map +0 -1
  307. package/dist/src/constants/property-types.js +0 -0
  308. package/dist/src/constants/specialized-properties.js +0 -223
  309. package/dist/src/constants/utilities.d.ts.map +0 -1
  310. package/dist/src/constants/utilities.js +0 -33
  311. package/dist/src/constants.d.ts.map +0 -1
  312. package/dist/src/constants.js +0 -1
  313. package/dist/src/deno-compile.d.ts.map +0 -1
  314. package/dist/src/deno-compile.js +0 -75
  315. package/dist/src/errors/base.d.ts.map +0 -1
  316. package/dist/src/errors/base.js +0 -49
  317. package/dist/src/errors/classes.d.ts.map +0 -1
  318. package/dist/src/errors/classes.js +0 -170
  319. package/dist/src/errors/guards.d.ts.map +0 -1
  320. package/dist/src/errors/guards.js +0 -39
  321. package/dist/src/errors/index.d.ts.map +0 -1
  322. package/dist/src/errors/index.js +0 -39
  323. package/dist/src/errors.d.ts.map +0 -1
  324. package/dist/src/errors.js +0 -1
  325. package/dist/src/file-utils/copy-and-find.d.ts.map +0 -1
  326. package/dist/src/file-utils/copy-and-find.js +0 -89
  327. package/dist/src/file-utils/export-operations.d.ts.map +0 -1
  328. package/dist/src/file-utils/export-operations.js +0 -40
  329. package/dist/src/file-utils/import-operations.d.ts.map +0 -1
  330. package/dist/src/file-utils/import-operations.js +0 -42
  331. package/dist/src/file-utils/index.d.ts.map +0 -1
  332. package/dist/src/file-utils/index.js +0 -26
  333. package/dist/src/file-utils/mime-detection.d.ts.map +0 -1
  334. package/dist/src/file-utils/mime-detection.js +0 -45
  335. package/dist/src/folder-api/album-corroborate.d.ts.map +0 -1
  336. package/dist/src/folder-api/album-corroborate.js +0 -36
  337. package/dist/src/folder-api/album-discs.d.ts.map +0 -1
  338. package/dist/src/folder-api/album-discs.js +0 -122
  339. package/dist/src/folder-api/album-grouping.d.ts.map +0 -1
  340. package/dist/src/folder-api/album-grouping.js +0 -118
  341. package/dist/src/folder-api/album-identity.d.ts.map +0 -1
  342. package/dist/src/folder-api/album-identity.js +0 -151
  343. package/dist/src/folder-api/album-types.d.ts.map +0 -1
  344. package/dist/src/folder-api/album-types.js +0 -0
  345. package/dist/src/folder-api/directory-walker.d.ts.map +0 -1
  346. package/dist/src/folder-api/directory-walker.js +0 -35
  347. package/dist/src/folder-api/file-processors.d.ts.map +0 -1
  348. package/dist/src/folder-api/file-processors.js +0 -63
  349. package/dist/src/folder-api/folder-disc.d.ts.map +0 -1
  350. package/dist/src/folder-api/folder-disc.js +0 -169
  351. package/dist/src/folder-api/folder-operations.d.ts.map +0 -1
  352. package/dist/src/folder-api/folder-operations.js +0 -54
  353. package/dist/src/folder-api/index.d.ts.map +0 -1
  354. package/dist/src/folder-api/scan-for-albums.d.ts.map +0 -1
  355. package/dist/src/folder-api/scan-for-albums.js +0 -20
  356. package/dist/src/folder-api/scan-operations.d.ts.map +0 -1
  357. package/dist/src/folder-api/scan-operations.js +0 -77
  358. package/dist/src/folder-api/types.d.ts.map +0 -1
  359. package/dist/src/folder-api/types.js +0 -21
  360. package/dist/src/msgpack/decoder.d.ts.map +0 -1
  361. package/dist/src/msgpack/decoder.js +0 -215
  362. package/dist/src/msgpack/encoder.d.ts.map +0 -1
  363. package/dist/src/msgpack/encoder.js +0 -249
  364. package/dist/src/msgpack/index.d.ts.map +0 -1
  365. package/dist/src/msgpack/index.js +0 -56
  366. package/dist/src/msgpack/types.d.ts.map +0 -1
  367. package/dist/src/msgpack/types.js +0 -12
  368. package/dist/src/msgpack/utils.d.ts.map +0 -1
  369. package/dist/src/msgpack/utils.js +0 -134
  370. package/dist/src/runtime/deno-detect.d.ts +0 -8
  371. package/dist/src/runtime/deno-detect.d.ts.map +0 -1
  372. package/dist/src/runtime/deno-detect.js +0 -6
  373. package/dist/src/runtime/detector.d.ts.map +0 -1
  374. package/dist/src/runtime/detector.js +0 -181
  375. package/dist/src/runtime/loader-types.d.ts.map +0 -1
  376. package/dist/src/runtime/loader-types.js +0 -10
  377. package/dist/src/runtime/module-loader-browser.d.ts.map +0 -1
  378. package/dist/src/runtime/module-loader-browser.js +0 -37
  379. package/dist/src/runtime/module-loader.d.ts.map +0 -1
  380. package/dist/src/runtime/module-loader.js +0 -119
  381. package/dist/src/runtime/platform-io.d.ts.map +0 -1
  382. package/dist/src/runtime/platform-io.js +0 -188
  383. package/dist/src/runtime/unified-loader/index.d.ts.map +0 -1
  384. package/dist/src/runtime/unified-loader/loader.d.ts.map +0 -1
  385. package/dist/src/runtime/unified-loader/loader.js +0 -84
  386. package/dist/src/runtime/unified-loader/module-loading.d.ts.map +0 -1
  387. package/dist/src/runtime/unified-loader/module-loading.js +0 -122
  388. package/dist/src/runtime/unified-loader/module-selection.d.ts.map +0 -1
  389. package/dist/src/runtime/unified-loader/module-selection.js +0 -41
  390. package/dist/src/runtime/unified-loader/types.d.ts.map +0 -1
  391. package/dist/src/runtime/unified-loader/types.js +0 -25
  392. package/dist/src/runtime/wasi-adapter/adapter.d.ts.map +0 -1
  393. package/dist/src/runtime/wasi-adapter/adapter.js +0 -130
  394. package/dist/src/runtime/wasi-adapter/audio-properties.d.ts.map +0 -1
  395. package/dist/src/runtime/wasi-adapter/audio-properties.js +0 -102
  396. package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +0 -1
  397. package/dist/src/runtime/wasi-adapter/file-handle.js +0 -197
  398. package/dist/src/runtime/wasi-adapter/handle-state.d.ts.map +0 -1
  399. package/dist/src/runtime/wasi-adapter/handle-state.js +0 -58
  400. package/dist/src/runtime/wasi-adapter/index.d.ts.map +0 -1
  401. package/dist/src/runtime/wasi-adapter/mp4-items.d.ts.map +0 -1
  402. package/dist/src/runtime/wasi-adapter/mp4-items.js +0 -80
  403. package/dist/src/runtime/wasi-adapter/path-open.d.ts.map +0 -1
  404. package/dist/src/runtime/wasi-adapter/path-open.js +0 -76
  405. package/dist/src/runtime/wasi-adapter/property-surface.d.ts.map +0 -1
  406. package/dist/src/runtime/wasi-adapter/property-surface.js +0 -104
  407. package/dist/src/runtime/wasi-adapter/structured-fields.d.ts.map +0 -1
  408. package/dist/src/runtime/wasi-adapter/structured-fields.js +0 -139
  409. package/dist/src/runtime/wasi-adapter/tag-keys.d.ts.map +0 -1
  410. package/dist/src/runtime/wasi-adapter/tag-keys.js +0 -46
  411. package/dist/src/runtime/wasi-adapter/wasm-io.d.ts.map +0 -1
  412. package/dist/src/runtime/wasi-adapter/wasm-io.js +0 -257
  413. package/dist/src/runtime/wasi-fs-deno.d.ts.map +0 -1
  414. package/dist/src/runtime/wasi-fs-deno.js +0 -26
  415. package/dist/src/runtime/wasi-fs-node.d.ts.map +0 -1
  416. package/dist/src/runtime/wasi-fs-node.js +0 -66
  417. package/dist/src/runtime/wasi-fs-provider.d.ts.map +0 -1
  418. package/dist/src/runtime/wasi-fs-provider.js +0 -0
  419. package/dist/src/runtime/wasi-host-loader.d.ts.map +0 -1
  420. package/dist/src/runtime/wasi-host-loader.js +0 -114
  421. package/dist/src/runtime/wasi-host.d.ts.map +0 -1
  422. package/dist/src/runtime/wasi-host.js +0 -202
  423. package/dist/src/runtime/wasi-memory.d.ts.map +0 -1
  424. package/dist/src/runtime/wasi-memory.js +0 -197
  425. package/dist/src/runtime/wasmer-sdk-loader/types.d.ts.map +0 -1
  426. package/dist/src/runtime/wasmer-sdk-loader/types.js +0 -12
  427. package/dist/src/simple/batch-operations.d.ts.map +0 -1
  428. package/dist/src/simple/batch-operations.js +0 -186
  429. package/dist/src/simple/checksum-operations.d.ts.map +0 -1
  430. package/dist/src/simple/checksum-operations.js +0 -7
  431. package/dist/src/simple/config.d.ts.map +0 -1
  432. package/dist/src/simple/config.js +0 -18
  433. package/dist/src/simple/index.d.ts.map +0 -1
  434. package/dist/src/simple/index.js +0 -60
  435. package/dist/src/simple/picture-operations.d.ts.map +0 -1
  436. package/dist/src/simple/picture-operations.js +0 -68
  437. package/dist/src/simple/tag-operations.d.ts.map +0 -1
  438. package/dist/src/simple/tag-operations.js +0 -90
  439. package/dist/src/simple/with-audio-file.d.ts.map +0 -1
  440. package/dist/src/simple/with-audio-file.js +0 -39
  441. package/dist/src/taglib/audio-file-base.d.ts.map +0 -1
  442. package/dist/src/taglib/audio-file-base.js +0 -187
  443. package/dist/src/taglib/audio-file-bwf.d.ts.map +0 -1
  444. package/dist/src/taglib/audio-file-bwf.js +0 -41
  445. package/dist/src/taglib/audio-file-checksum.d.ts.map +0 -1
  446. package/dist/src/taglib/audio-file-checksum.js +0 -77
  447. package/dist/src/taglib/audio-file-impl.d.ts.map +0 -1
  448. package/dist/src/taglib/audio-file-impl.js +0 -317
  449. package/dist/src/taglib/audio-file-interface.d.ts.map +0 -1
  450. package/dist/src/taglib/audio-file-interface.js +0 -0
  451. package/dist/src/taglib/auto-dispose.d.ts.map +0 -1
  452. package/dist/src/taglib/auto-dispose.js +0 -13
  453. package/dist/src/taglib/embind-adapter.d.ts.map +0 -1
  454. package/dist/src/taglib/embind-adapter.js +0 -141
  455. package/dist/src/taglib/extra-state-registry.d.ts.map +0 -1
  456. package/dist/src/taglib/extra-state-registry.js +0 -78
  457. package/dist/src/taglib/id3v2-frames.d.ts.map +0 -1
  458. package/dist/src/taglib/id3v2-frames.js +0 -42
  459. package/dist/src/taglib/index.d.ts.map +0 -1
  460. package/dist/src/taglib/index.js +0 -41
  461. package/dist/src/taglib/load-audio-data.d.ts.map +0 -1
  462. package/dist/src/taglib/load-audio-data.js +0 -51
  463. package/dist/src/taglib/media-ranges.d.ts.map +0 -1
  464. package/dist/src/taglib/media-ranges.js +0 -192
  465. package/dist/src/taglib/metadata-extent.d.ts.map +0 -1
  466. package/dist/src/taglib/metadata-extent.js +0 -189
  467. package/dist/src/taglib/mp4-item-names.d.ts.map +0 -1
  468. package/dist/src/taglib/mp4-item-names.js +0 -4
  469. package/dist/src/taglib/mutable-tag-impl.d.ts.map +0 -1
  470. package/dist/src/taglib/mutable-tag-impl.js +0 -88
  471. package/dist/src/taglib/mutable-tag.d.ts.map +0 -1
  472. package/dist/src/taglib/mutable-tag.js +0 -0
  473. package/dist/src/taglib/save-reconstruct.d.ts.map +0 -1
  474. package/dist/src/taglib/save-reconstruct.js +0 -43
  475. package/dist/src/taglib/taglib-class.d.ts.map +0 -1
  476. package/dist/src/taglib/taglib-class.js +0 -195
  477. package/dist/src/taglib.d.ts.map +0 -1
  478. package/dist/src/taglib.js +0 -1
  479. package/dist/src/types/audio-formats.d.ts.map +0 -1
  480. package/dist/src/types/audio-formats.js +0 -6
  481. package/dist/src/types/bwf.d.ts.map +0 -1
  482. package/dist/src/types/bwf.js +0 -0
  483. package/dist/src/types/chapters.d.ts.map +0 -1
  484. package/dist/src/types/chapters.js +0 -0
  485. package/dist/src/types/config.d.ts.map +0 -1
  486. package/dist/src/types/config.js +0 -0
  487. package/dist/src/types/format-property-keys.d.ts.map +0 -1
  488. package/dist/src/types/format-property-keys.js +0 -0
  489. package/dist/src/types/index.d.ts.map +0 -1
  490. package/dist/src/types/index.js +0 -8
  491. package/dist/src/types/metadata-mappings.d.ts.map +0 -1
  492. package/dist/src/types/metadata-mappings.js +0 -252
  493. package/dist/src/types/pictures.d.ts.map +0 -1
  494. package/dist/src/types/pictures.js +0 -64
  495. package/dist/src/types/tags.d.ts.map +0 -1
  496. package/dist/src/types/tags.js +0 -0
  497. package/dist/src/types.d.ts.map +0 -1
  498. package/dist/src/types.js +0 -1
  499. package/dist/src/utils/file.d.ts.map +0 -1
  500. package/dist/src/utils/file.js +0 -52
  501. package/dist/src/utils/mirror-fields.d.ts.map +0 -1
  502. package/dist/src/utils/mirror-fields.js +0 -75
  503. package/dist/src/utils/node-fs.d.ts.map +0 -1
  504. package/dist/src/utils/node-fs.js +0 -22
  505. package/dist/src/utils/path.d.ts.map +0 -1
  506. package/dist/src/utils/path.js +0 -36
  507. package/dist/src/utils/rating.d.ts.map +0 -1
  508. package/dist/src/utils/rating.js +0 -73
  509. package/dist/src/utils/tag-mapping.d.ts.map +0 -1
  510. package/dist/src/utils/tag-mapping.js +0 -214
  511. package/dist/src/utils/write.d.ts.map +0 -1
  512. package/dist/src/utils/write.js +0 -17
  513. package/dist/src/version.d.ts +0 -2
  514. package/dist/src/version.d.ts.map +0 -1
  515. package/dist/src/version.js +0 -4
  516. package/dist/src/wasm.d.ts.map +0 -1
  517. package/dist/src/wasm.js +0 -0
  518. package/dist/src/web-utils/canvas.d.ts.map +0 -1
  519. package/dist/src/web-utils/canvas.js +0 -60
  520. package/dist/src/web-utils/data-url.d.ts.map +0 -1
  521. package/dist/src/web-utils/data-url.js +0 -34
  522. package/dist/src/web-utils/dom-integration.d.ts.map +0 -1
  523. package/dist/src/web-utils/dom-integration.js +0 -53
  524. package/dist/src/web-utils/index.d.ts.map +0 -1
  525. package/dist/src/web-utils/index.js +0 -21
  526. /package/dist/{src/bwf → bwf}/bext.d.ts +0 -0
  527. /package/dist/{src/constants → constants}/additional-properties.d.ts +0 -0
  528. /package/dist/{src/constants → constants}/basic-properties.d.ts +0 -0
  529. /package/dist/{src/constants → constants}/complex-properties.d.ts +0 -0
  530. /package/dist/{src/constants → constants}/format-mappings.d.ts +0 -0
  531. /package/dist/{src/constants → constants}/general-extended-properties.d.ts +0 -0
  532. /package/dist/{src/constants → constants}/index.d.ts +0 -0
  533. /package/dist/{src/constants → constants}/property-types.d.ts +0 -0
  534. /package/dist/{src/constants → constants}/specialized-properties.d.ts +0 -0
  535. /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
  536. /package/dist/{src/errors → errors}/base.d.ts +0 -0
  537. /package/dist/{src/errors → errors}/classes.d.ts +0 -0
  538. /package/dist/{src/errors → errors}/guards.d.ts +0 -0
  539. /package/dist/{src/errors → errors}/index.d.ts +0 -0
  540. /package/dist/{src/errors.d.ts → errors.d.ts} +0 -0
  541. /package/dist/{src/file-utils → file-utils}/copy-and-find.d.ts +0 -0
  542. /package/dist/{src/file-utils → file-utils}/export-operations.d.ts +0 -0
  543. /package/dist/{src/file-utils → file-utils}/import-operations.d.ts +0 -0
  544. /package/dist/{src/file-utils → file-utils}/index.d.ts +0 -0
  545. /package/dist/{src/file-utils → file-utils}/mime-detection.d.ts +0 -0
  546. /package/dist/{src/folder-api → folder-api}/album-corroborate.d.ts +0 -0
  547. /package/dist/{src/folder-api → folder-api}/album-discs.d.ts +0 -0
  548. /package/dist/{src/folder-api → folder-api}/album-grouping.d.ts +0 -0
  549. /package/dist/{src/folder-api → folder-api}/album-identity.d.ts +0 -0
  550. /package/dist/{src/folder-api → folder-api}/album-types.d.ts +0 -0
  551. /package/dist/{src/folder-api → folder-api}/directory-walker.d.ts +0 -0
  552. /package/dist/{src/folder-api → folder-api}/file-processors.d.ts +0 -0
  553. /package/dist/{src/folder-api → folder-api}/folder-disc.d.ts +0 -0
  554. /package/dist/{src/folder-api → folder-api}/folder-operations.d.ts +0 -0
  555. /package/dist/{src/folder-api → folder-api}/index.d.ts +0 -0
  556. /package/dist/{src/folder-api → folder-api}/scan-for-albums.d.ts +0 -0
  557. /package/dist/{src/folder-api → folder-api}/scan-operations.d.ts +0 -0
  558. /package/dist/{src/folder-api → folder-api}/types.d.ts +0 -0
  559. /package/dist/{src/msgpack → msgpack}/decoder.d.ts +0 -0
  560. /package/dist/{src/msgpack → msgpack}/encoder.d.ts +0 -0
  561. /package/dist/{src/msgpack → msgpack}/index.d.ts +0 -0
  562. /package/dist/{src/msgpack → msgpack}/utils.d.ts +0 -0
  563. /package/dist/{src/runtime → runtime}/loader-types.d.ts +0 -0
  564. /package/dist/{src/runtime → runtime}/module-loader-browser.d.ts +0 -0
  565. /package/dist/{src/runtime → runtime}/module-loader.d.ts +0 -0
  566. /package/dist/{src/runtime → runtime}/platform-io.d.ts +0 -0
  567. /package/dist/{src/runtime → runtime}/unified-loader/index.d.ts +0 -0
  568. /package/dist/{src/runtime → runtime}/unified-loader/loader.d.ts +0 -0
  569. /package/dist/{src/runtime → runtime}/unified-loader/module-loading.d.ts +0 -0
  570. /package/dist/{src/runtime → runtime}/unified-loader/module-selection.d.ts +0 -0
  571. /package/dist/{src/runtime → runtime}/unified-loader/types.d.ts +0 -0
  572. /package/dist/{src/runtime → runtime}/wasi-adapter/adapter.d.ts +0 -0
  573. /package/dist/{src/runtime → runtime}/wasi-adapter/audio-properties.d.ts +0 -0
  574. /package/dist/{src/runtime → runtime}/wasi-adapter/file-handle.d.ts +0 -0
  575. /package/dist/{src/runtime → runtime}/wasi-adapter/handle-state.d.ts +0 -0
  576. /package/dist/{src/runtime → runtime}/wasi-adapter/index.d.ts +0 -0
  577. /package/dist/{src/runtime → runtime}/wasi-adapter/mp4-items.d.ts +0 -0
  578. /package/dist/{src/runtime → runtime}/wasi-adapter/path-open.d.ts +0 -0
  579. /package/dist/{src/runtime → runtime}/wasi-adapter/property-surface.d.ts +0 -0
  580. /package/dist/{src/runtime → runtime}/wasi-adapter/structured-fields.d.ts +0 -0
  581. /package/dist/{src/runtime → runtime}/wasi-adapter/tag-keys.d.ts +0 -0
  582. /package/dist/{src/runtime → runtime}/wasi-adapter/wasm-io.d.ts +0 -0
  583. /package/dist/{src/runtime → runtime}/wasi-fs-deno.d.ts +0 -0
  584. /package/dist/{src/runtime → runtime}/wasi-fs-node.d.ts +0 -0
  585. /package/dist/{src/runtime → runtime}/wasi-fs-provider.d.ts +0 -0
  586. /package/dist/{src/runtime → runtime}/wasi-host-loader.d.ts +0 -0
  587. /package/dist/{src/runtime → runtime}/wasi-host.d.ts +0 -0
  588. /package/dist/{src/runtime → runtime}/wasi-memory.d.ts +0 -0
  589. /package/dist/{src/runtime → runtime}/wasmer-sdk-loader/types.d.ts +0 -0
  590. /package/dist/{src/simple → simple}/batch-operations.d.ts +0 -0
  591. /package/dist/{src/simple → simple}/checksum-operations.d.ts +0 -0
  592. /package/dist/{src/simple → simple}/config.d.ts +0 -0
  593. /package/dist/{src/simple → simple}/index.d.ts +0 -0
  594. /package/dist/{src/simple → simple}/picture-operations.d.ts +0 -0
  595. /package/dist/{src/simple → simple}/tag-operations.d.ts +0 -0
  596. /package/dist/{src/simple → simple}/with-audio-file.d.ts +0 -0
  597. /package/dist/{src/taglib → taglib}/audio-file-base.d.ts +0 -0
  598. /package/dist/{src/taglib → taglib}/audio-file-bwf.d.ts +0 -0
  599. /package/dist/{src/taglib → taglib}/audio-file-checksum.d.ts +0 -0
  600. /package/dist/{src/taglib → taglib}/audio-file-impl.d.ts +0 -0
  601. /package/dist/{src/taglib → taglib}/audio-file-interface.d.ts +0 -0
  602. /package/dist/{src/taglib → taglib}/auto-dispose.d.ts +0 -0
  603. /package/dist/{src/taglib → taglib}/embind-adapter.d.ts +0 -0
  604. /package/dist/{src/taglib → taglib}/extra-state-registry.d.ts +0 -0
  605. /package/dist/{src/taglib → taglib}/index.d.ts +0 -0
  606. /package/dist/{src/taglib → taglib}/load-audio-data.d.ts +0 -0
  607. /package/dist/{src/taglib → taglib}/media-ranges.d.ts +0 -0
  608. /package/dist/{src/taglib → taglib}/metadata-extent.d.ts +0 -0
  609. /package/dist/{src/taglib → taglib}/mp4-item-names.d.ts +0 -0
  610. /package/dist/{src/taglib → taglib}/mutable-tag-impl.d.ts +0 -0
  611. /package/dist/{src/taglib → taglib}/mutable-tag.d.ts +0 -0
  612. /package/dist/{src/taglib → taglib}/save-reconstruct.d.ts +0 -0
  613. /package/dist/{src/taglib → taglib}/taglib-class.d.ts +0 -0
  614. /package/dist/{src/taglib.d.ts → taglib.d.ts} +0 -0
  615. /package/dist/{src/types → types}/bwf.d.ts +0 -0
  616. /package/dist/{src/types → types}/chapters.d.ts +0 -0
  617. /package/dist/{src/types → types}/config.d.ts +0 -0
  618. /package/dist/{src/types → types}/format-property-keys.d.ts +0 -0
  619. /package/dist/{src/types → types}/index.d.ts +0 -0
  620. /package/dist/{src/types → types}/metadata-mappings.d.ts +0 -0
  621. /package/dist/{src/types → types}/pictures.d.ts +0 -0
  622. /package/dist/{src/types → types}/tags.d.ts +0 -0
  623. /package/dist/{src/types.d.ts → types.d.ts} +0 -0
  624. /package/dist/{src/utils → utils}/file.d.ts +0 -0
  625. /package/dist/{src/utils → utils}/mirror-fields.d.ts +0 -0
  626. /package/dist/{src/utils → utils}/node-fs.d.ts +0 -0
  627. /package/dist/{src/utils → utils}/path.d.ts +0 -0
  628. /package/dist/{src/utils → utils}/rating.d.ts +0 -0
  629. /package/dist/{src/utils → utils}/tag-mapping.d.ts +0 -0
  630. /package/dist/{src/utils → utils}/write.d.ts +0 -0
  631. /package/dist/{src/wasm.d.ts → wasm.d.ts} +0 -0
  632. /package/dist/{src/web-utils → web-utils}/canvas.d.ts +0 -0
  633. /package/dist/{src/web-utils → web-utils}/data-url.d.ts +0 -0
  634. /package/dist/{src/web-utils → web-utils}/dom-integration.d.ts +0 -0
  635. /package/dist/{src/web-utils → web-utils}/index.d.ts +0 -0
@@ -0,0 +1,245 @@
1
+ import { fromTagLibKey } from "../constants/properties.js";
2
+ import { isNamedAudioInput } from "../types/audio-formats.js";
3
+ import { InvalidFormatError } from "../errors/classes.js";
4
+ import "../errors.js";
5
+ import { mergeTagUpdatesInto, readExtendedTag } from "../utils/tag-mapping.js";
6
+ import { getTagLib } from "./config.js";
7
+ import { withAudioFileSaveToFile } from "./with-audio-file.js";
8
+ //#region src/simple/batch-operations.ts
9
+ async function executeBatch(files, options, processor) {
10
+ if (files.length === 0) return {
11
+ items: [],
12
+ duration: 0
13
+ };
14
+ const startTime = Date.now();
15
+ const { concurrency = 4, continueOnError = true, onProgress, signal } = options;
16
+ const items = new Array(files.length);
17
+ const taglib = await getTagLib();
18
+ let processed = 0;
19
+ const total = files.length;
20
+ for (let i = 0; i < files.length; i += concurrency) {
21
+ signal?.throwIfAborted();
22
+ const chunkPromises = files.slice(i, i + concurrency).map(async (file, idx) => {
23
+ const index = i + idx;
24
+ const fileName = typeof file === "string" ? file : file instanceof File ? file.name : isNamedAudioInput(file) ? file.name : `buffer-${index}`;
25
+ try {
26
+ const audioFile = await taglib.open(file);
27
+ try {
28
+ if (!audioFile.isValid()) throw new InvalidFormatError("File may be corrupted or in an unsupported format");
29
+ items[index] = {
30
+ status: "ok",
31
+ path: fileName,
32
+ data: processor(audioFile)
33
+ };
34
+ } finally {
35
+ audioFile.dispose();
36
+ }
37
+ } catch (error) {
38
+ const err = error instanceof Error ? error : new Error(String(error));
39
+ items[index] = {
40
+ status: "error",
41
+ path: fileName,
42
+ error: err
43
+ };
44
+ if (!continueOnError) throw err;
45
+ }
46
+ processed++;
47
+ onProgress?.(processed, total, fileName);
48
+ });
49
+ await Promise.all(chunkPromises);
50
+ }
51
+ return {
52
+ items,
53
+ duration: Date.now() - startTime
54
+ };
55
+ }
56
+ /**
57
+ * Read tags from multiple files with configurable concurrency.
58
+ *
59
+ * @param files - Array of file paths, Uint8Arrays, ArrayBuffers, File objects, or NamedAudioInputs.
60
+ * @param options - Batch processing options (concurrency, error handling, progress).
61
+ * @returns Batch result containing a `BatchItem` per file and total duration in ms.
62
+ * @throws If `continueOnError` is `false` and any file fails to process.
63
+ */
64
+ async function readTagsBatch(files, options = {}) {
65
+ return executeBatch(files, options, (audioFile) => readExtendedTag(audioFile, options.includeProperties));
66
+ }
67
+ /**
68
+ * Read audio properties from multiple files with configurable concurrency.
69
+ *
70
+ * @param files - Array of file paths, Uint8Arrays, ArrayBuffers, File objects, or NamedAudioInputs.
71
+ * @param options - Batch processing options (concurrency, error handling, progress).
72
+ * @returns Batch result containing a `BatchItem` per file and total duration in ms.
73
+ * @throws If `continueOnError` is `false` and any file fails to process.
74
+ */
75
+ async function readPropertiesBatch(files, options = {}) {
76
+ return executeBatch(files, options, (audioFile) => audioFile.audioProperties());
77
+ }
78
+ function extractDynamics(audioFile) {
79
+ const dynamics = {};
80
+ for (const field of [
81
+ "replayGainTrackGain",
82
+ "replayGainTrackPeak",
83
+ "replayGainAlbumGain",
84
+ "replayGainAlbumPeak"
85
+ ]) {
86
+ const val = audioFile.getProperty(field)?.[0];
87
+ if (val !== void 0) dynamics[field] = val;
88
+ }
89
+ let appleSoundCheck = audioFile.getProperty("appleSoundCheck")?.[0];
90
+ if (!appleSoundCheck && audioFile.isMP4()) appleSoundCheck = audioFile.getMP4Item("----:com.apple.iTunes:iTunNORM");
91
+ if (appleSoundCheck) dynamics.appleSoundCheck = appleSoundCheck;
92
+ return Object.keys(dynamics).length > 0 ? dynamics : void 0;
93
+ }
94
+ /**
95
+ * Read complete metadata (tags, properties, cover art, dynamics) from a single file.
96
+ *
97
+ * @param file - A file path, Uint8Array, ArrayBuffer, File object, or NamedAudioInput.
98
+ * @param options - Read options; `includeProperties` (wire keys) surfaces raw
99
+ * values in `tags.extraProperties` (taglib-3s1f).
100
+ * @returns The file's complete metadata.
101
+ * @throws `InvalidFormatError` if the file is corrupted or in an unsupported format.
102
+ */
103
+ async function readMetadata(file, options = {}) {
104
+ const audioFile = await (await getTagLib()).open(file);
105
+ try {
106
+ if (!audioFile.isValid()) {
107
+ let name;
108
+ if (typeof file === "string") name = file;
109
+ else if (file instanceof File) name = file.name;
110
+ else if (isNamedAudioInput(file)) name = file.name;
111
+ else name = `buffer (${file.byteLength} bytes)`;
112
+ throw new InvalidFormatError(`File may be corrupted or in an unsupported format. File: ${name}`);
113
+ }
114
+ const dynamics = extractDynamics(audioFile);
115
+ return {
116
+ tags: readExtendedTag(audioFile, options.includeProperties),
117
+ properties: audioFile.audioProperties(),
118
+ hasCoverArt: audioFile.getPictures().length > 0,
119
+ ...dynamics !== void 0 ? { dynamics } : {}
120
+ };
121
+ } finally {
122
+ audioFile.dispose();
123
+ }
124
+ }
125
+ /**
126
+ * Read complete metadata from multiple files with configurable concurrency.
127
+ *
128
+ * @param files - Array of file paths, Uint8Arrays, ArrayBuffers, File objects, or NamedAudioInputs.
129
+ * @param options - Batch processing options (concurrency, error handling, progress).
130
+ * @returns Batch result containing a `BatchItem` per file and total duration in ms.
131
+ * @throws If `continueOnError` is `false` and any file fails to process.
132
+ */
133
+ async function readMetadataBatch(files, options = {}) {
134
+ return executeBatch(files, options, (audioFile) => {
135
+ const dynamics = extractDynamics(audioFile);
136
+ return {
137
+ tags: readExtendedTag(audioFile, options.includeProperties),
138
+ properties: audioFile.audioProperties(),
139
+ hasCoverArt: audioFile.getPictures().length > 0,
140
+ ...dynamics !== void 0 ? { dynamics } : {}
141
+ };
142
+ });
143
+ }
144
+ function entryPath(entry) {
145
+ return typeof entry === "string" ? entry : entry.path;
146
+ }
147
+ /**
148
+ * Shared batch-write driver: the read-side executeBatch contract applied to
149
+ * writes (taglib-pmhp). Per-file try/catch with ok/error items, abort between
150
+ * chunks (never mid-save), progress after each file, input-order-preserving
151
+ * results. Atomicity is inherited from saveToFile's temp-file save: a failed
152
+ * file is left in its pre-write state.
153
+ */
154
+ async function executeWriteBatch(entries, options, writer) {
155
+ if (entries.length === 0) return {
156
+ items: [],
157
+ duration: 0
158
+ };
159
+ await getTagLib();
160
+ const startTime = Date.now();
161
+ const { concurrency = 4, continueOnError = true, onProgress, signal } = options;
162
+ const items = new Array(entries.length);
163
+ let processed = 0;
164
+ const total = entries.length;
165
+ for (let i = 0; i < entries.length; i += concurrency) {
166
+ signal?.throwIfAborted();
167
+ const chunkPromises = entries.slice(i, i + concurrency).map(async (entry, idx) => {
168
+ const index = i + idx;
169
+ const path = entryPath(entry);
170
+ try {
171
+ await writer(path);
172
+ items[index] = {
173
+ status: "ok",
174
+ path,
175
+ data: void 0
176
+ };
177
+ } catch (error) {
178
+ const err = error instanceof Error ? error : new Error(String(error));
179
+ items[index] = {
180
+ status: "error",
181
+ path,
182
+ error: err
183
+ };
184
+ if (!continueOnError) throw err;
185
+ }
186
+ processed++;
187
+ onProgress?.(processed, total, path);
188
+ });
189
+ await Promise.all(chunkPromises);
190
+ }
191
+ return {
192
+ items,
193
+ duration: Date.now() - startTime
194
+ };
195
+ }
196
+ /**
197
+ * Apply tag updates to multiple files with configurable concurrency.
198
+ *
199
+ * The batch write counterpart to {@link readTagsBatch}: same
200
+ * {@link BatchOptions} contract (concurrency, continueOnError, onProgress,
201
+ * signal). Each file is updated in ONE save via a single `setProperties`
202
+ * fold: the typed `tags` merge ({@link mergeTagUpdatesInto} — the same
203
+ * semantics as {@link applyTagsToFile}) plus the raw wire-key `properties`
204
+ * entries. Atomic temp-file save, so a failed file is left in its pre-write
205
+ * state.
206
+ *
207
+ * @param updates - Per-file tag updates; a path may appear more than once
208
+ * (the last update for a path wins).
209
+ * @param options - Batch processing options (concurrency, error handling,
210
+ * progress, abort).
211
+ * @returns A `BatchItem` per update in input order plus total duration in ms.
212
+ * @throws If `continueOnError` is `false` and any file fails to process.
213
+ */
214
+ async function writeTagsBatch(updates, options = {}) {
215
+ const byPath = new Map(updates.map((u) => [u.path, u]));
216
+ return executeWriteBatch(updates, options, (path) => withAudioFileSaveToFile(path, (audioFile) => {
217
+ const update = byPath.get(path);
218
+ const merged = update.tags !== void 0 ? mergeTagUpdatesInto(audioFile.properties(), update.tags) : audioFile.properties();
219
+ if (update.properties !== void 0) for (const [key, values] of Object.entries(update.properties)) merged[fromTagLibKey(key)] = values;
220
+ audioFile.setProperties(merged);
221
+ }));
222
+ }
223
+ /**
224
+ * Open, mutate, and save multiple files with configurable concurrency.
225
+ *
226
+ * Mutator-callback variant of {@link writeTagsBatch}: the callback receives
227
+ * the open {@link AudioFile} (Full-API style) plus the `path` it was opened
228
+ * from — the pair is a per-invocation contract, so precomputed per-path
229
+ * plans can be looked up without relying on invocation order (taglib-pmhp
230
+ * review). A one-argument mutator keeps working. Changes are saved per file;
231
+ * same {@link BatchOptions} contract and atomicity guarantees.
232
+ *
233
+ * @param files - File paths on disk, updated in place.
234
+ * @param mutator - Called once per file with the open audio file and its
235
+ * path; changes are saved automatically.
236
+ * @param options - Batch processing options (concurrency, error handling,
237
+ * progress, abort).
238
+ * @returns A `BatchItem` per file in input order plus total duration in ms.
239
+ * @throws If `continueOnError` is `false` and any file fails to process.
240
+ */
241
+ async function editTagsBatch(files, mutator, options = {}) {
242
+ return executeWriteBatch(files, options, (path) => withAudioFileSaveToFile(path, (audioFile) => mutator(audioFile, path)));
243
+ }
244
+ //#endregion
245
+ export { editTagsBatch, readMetadata, readMetadataBatch, readPropertiesBatch, readTagsBatch, writeTagsBatch };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checksum-operations.d.ts","sourceRoot":"","sources":["../../src/simple/checksum-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACrB,MAAM,kCAAkC,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,cAAc,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAExB"}
@@ -0,0 +1,28 @@
1
+ import { withAudioFile } from "./with-audio-file.js";
2
+ //#region src/simple/checksum-operations.ts
3
+ /**
4
+ * Reads a checksum of an audio file's media content.
5
+ *
6
+ * The digest is of the *encoded media payload* — the bytes that are the audio,
7
+ * not the tags around them — so it survives a tag edit, with one boundary: an
8
+ * ID3v2 tag appended after a FLAC's audio is inside that payload, so editing it
9
+ * does move the hash. Formats whose payload cannot be delimited answer the
10
+ * whole file instead and say so (`source: "file"`), where a tag edit does move
11
+ * the hash.
12
+ *
13
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
14
+ * @param options - `basis: "pcm"` asks for FLAC's STREAMINFO MD5, the digest of
15
+ * the *uncompressed* stream, instead of the encoded payload's SHA-256
16
+ * @returns The hex digest, the algorithm, what it covers (`source`), and how
17
+ * many bytes were hashed
18
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
19
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
20
+ * @throws {UnsupportedFormatError} If `basis: "pcm"` is asked of a non-FLAC file
21
+ * @throws {MetadataError} If the payload cannot be walked, or the handle holds
22
+ * no bytes and no readable source
23
+ */
24
+ async function readMediaChecksum(file, options) {
25
+ return withAudioFile(file, (audioFile) => audioFile.mediaChecksum(options));
26
+ }
27
+ //#endregion
28
+ export { readMediaChecksum };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/simple/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAK3C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAGpD;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CASjD"}
@@ -0,0 +1,17 @@
1
+ //#region src/simple/config.ts
2
+ let cachedTagLib = null;
3
+ let bufferModeEnabled = false;
4
+ function setBufferMode(enabled) {
5
+ bufferModeEnabled = enabled;
6
+ cachedTagLib = null;
7
+ }
8
+ async function getTagLib() {
9
+ if (!cachedTagLib) {
10
+ const { TagLib } = await import("../taglib.js");
11
+ const initOptions = bufferModeEnabled ? { forceWasmType: "emscripten" } : void 0;
12
+ cachedTagLib = await TagLib.initialize(initOptions);
13
+ }
14
+ return cachedTagLib;
15
+ }
16
+ //#endregion
17
+ export { getTagLib, setBufferMode };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EACL,SAAS,EACT,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACX,GAAG,EACH,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES } from "../types/pictures.js";
2
+ import "../types.js";
3
+ import { getTagLib, setBufferMode } from "./config.js";
4
+ import { applyTags, applyTagsToFile, clearTags, isValidAudioFile, readFormat, readProperties, readTags } from "./tag-operations.js";
5
+ import { addPicture, applyCoverArt, applyPictures, clearPictures, findPictureByType, readCoverArt, readPictureMetadata, readPictures, replacePictureByType } from "./picture-operations.js";
6
+ import { editTagsBatch, readMetadata, readMetadataBatch, readPropertiesBatch, readTagsBatch, writeTagsBatch } from "./batch-operations.js";
7
+ import { readMediaChecksum } from "./checksum-operations.js";
8
+ export { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES, addPicture, applyCoverArt, applyPictures, applyTags, applyTagsToFile, clearPictures, clearTags, editTagsBatch, findPictureByType, getTagLib, isValidAudioFile, readCoverArt, readFormat, readMediaChecksum, readMetadata, readMetadataBatch, readPictureMetadata, readPictures, readProperties, readPropertiesBatch, readTags, readTagsBatch, replacePictureByType, setBufferMode, writeTagsBatch };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"picture-operations.d.ts","sourceRoot":"","sources":["../../src/simple/picture-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGxE;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAE3E;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,OAAO,EAAE,GAClB,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAYjC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,cAAc,EACpB,SAAS,EAAE,UAAU,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,CAAC,CAQrB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,EAAE,EACnB,IAAI,EAAE,WAAW,GAChB,OAAO,GAAG,SAAS,CAErB;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,EACpB,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,UAAU,CAAC,CAUrB;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CACtE,KAAK,CAAC;IACJ,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CACH,CAQA"}
@@ -0,0 +1,132 @@
1
+ import { withAudioFile, withAudioFileSave } from "./with-audio-file.js";
2
+ //#region src/simple/picture-operations.ts
3
+ /**
4
+ * Reads all embedded pictures from an audio file.
5
+ *
6
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
7
+ * @returns Array of all pictures embedded in the file
8
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
9
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
10
+ */
11
+ async function readPictures(file) {
12
+ return withAudioFile(file, (audioFile) => audioFile.getPictures());
13
+ }
14
+ /**
15
+ * Replaces all embedded pictures in an audio file and returns the modified content as a buffer.
16
+ *
17
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
18
+ * @param pictures - Complete set of pictures to embed; replaces any existing pictures
19
+ * @returns Modified audio file contents with the updated picture set
20
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
21
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
22
+ * @throws {FileOperationError} If saving the modified picture data fails
23
+ */
24
+ async function applyPictures(file, pictures) {
25
+ return withAudioFileSave(file, (audioFile) => {
26
+ audioFile.setPictures(pictures);
27
+ });
28
+ }
29
+ /**
30
+ * Appends a single picture to an audio file's existing embedded pictures.
31
+ *
32
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
33
+ * @param picture - Picture to append to the file
34
+ * @returns Modified audio file contents with the new picture added
35
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
36
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
37
+ * @throws {FileOperationError} If saving the modified picture data fails
38
+ */
39
+ async function addPicture(file, picture) {
40
+ return withAudioFileSave(file, (audioFile) => {
41
+ audioFile.addPicture(picture);
42
+ });
43
+ }
44
+ /**
45
+ * Removes all embedded pictures from an audio file and returns the modified content as a buffer.
46
+ *
47
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
48
+ * @returns Modified audio file contents with all pictures removed
49
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
50
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
51
+ * @throws {FileOperationError} If saving the modified file fails
52
+ */
53
+ async function clearPictures(file) {
54
+ return applyPictures(file, []);
55
+ }
56
+ /**
57
+ * Reads the front cover art from an audio file, falling back to the first embedded picture.
58
+ *
59
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
60
+ * @returns Raw image bytes for the cover art, or `undefined` if no pictures are embedded
61
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
62
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
63
+ */
64
+ async function readCoverArt(file) {
65
+ const pictures = await readPictures(file);
66
+ if (pictures.length === 0) return;
67
+ const frontCover = pictures.find((pic) => pic.type === "FrontCover");
68
+ if (frontCover) return frontCover.data;
69
+ return pictures[0].data;
70
+ }
71
+ /**
72
+ * Replaces all embedded pictures with a single front cover image and returns the modified content as a buffer.
73
+ *
74
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
75
+ * @param imageData - Raw image bytes to embed as the front cover
76
+ * @param mimeType - MIME type of the image (e.g., `"image/jpeg"`, `"image/png"`)
77
+ * @returns Modified audio file contents with the new cover art
78
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
79
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
80
+ * @throws {FileOperationError} If saving the modified picture data fails
81
+ */
82
+ async function applyCoverArt(file, imageData, mimeType) {
83
+ return applyPictures(file, [{
84
+ mimeType,
85
+ data: imageData,
86
+ type: "FrontCover",
87
+ description: "Front Cover"
88
+ }]);
89
+ }
90
+ /**
91
+ * Finds the first picture of a given type from an array of pictures.
92
+ *
93
+ * @param pictures - Array of pictures to search
94
+ * @param type - Picture type to find (e.g., `"FrontCover"`, `"BackCover"`)
95
+ * @returns The first matching picture, or `undefined` if none is found
96
+ */
97
+ function findPictureByType(pictures, type) {
98
+ return pictures.find((pic) => pic.type === type);
99
+ }
100
+ /**
101
+ * Replaces all pictures of a given type with a new picture and returns the modified content as a buffer.
102
+ *
103
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
104
+ * @param newPicture - Replacement picture; its `type` determines which existing pictures are removed
105
+ * @returns Modified audio file contents with the updated picture
106
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
107
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
108
+ * @throws {FileOperationError} If saving the modified picture data fails
109
+ */
110
+ async function replacePictureByType(file, newPicture) {
111
+ const filteredPictures = (await readPictures(file)).filter((pic) => pic.type !== newPicture.type);
112
+ filteredPictures.push(newPicture);
113
+ return applyPictures(file, filteredPictures);
114
+ }
115
+ /**
116
+ * Reads picture metadata (type, MIME type, description, and size) without returning raw image data.
117
+ *
118
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
119
+ * @returns Array of metadata objects for each embedded picture; `size` is the byte length of the image data
120
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
121
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
122
+ */
123
+ async function readPictureMetadata(file) {
124
+ return (await readPictures(file)).map((pic) => ({
125
+ type: pic.type,
126
+ mimeType: pic.mimeType,
127
+ ...pic.description !== void 0 ? { description: pic.description } : {},
128
+ size: pic.data.length
129
+ }));
130
+ }
131
+ //#endregion
132
+ export { addPicture, applyCoverArt, applyPictures, clearPictures, findPictureByType, readCoverArt, readPictureMetadata, readPictures, replacePictureByType };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag-operations.d.ts","sourceRoot":"","sources":["../../src/simple/tag-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,QAAQ,EAER,QAAQ,EACT,MAAM,aAAa,CAAC;AAWrB;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE;IAAE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GAC7C,OAAO,CAAC,WAAW,CAAC,CAItB;AAED;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GACtB,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GACtB,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC,CAY1B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAY7E;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAW/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAsBzE"}
@@ -0,0 +1,125 @@
1
+ import { FileOperationError, MetadataError } from "../errors/classes.js";
2
+ import "../errors.js";
3
+ import { mergeTagUpdates, readExtendedTag } from "../utils/tag-mapping.js";
4
+ import { getTagLib } from "./config.js";
5
+ import { withAudioFile, withAudioFileSave, withAudioFileSaveToFile } from "./with-audio-file.js";
6
+ //#region src/simple/tag-operations.ts
7
+ /**
8
+ * Reads all metadata tags from an audio file.
9
+ *
10
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
11
+ * @param options - Read options; `includeProperties` (wire keys) surfaces raw
12
+ * values in `extraProperties` (taglib-3s1f)
13
+ * @returns Parsed tag fields including extended metadata from the audio file
14
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
15
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
16
+ */
17
+ async function readTags(file, options = {}) {
18
+ return withAudioFile(file, (audioFile) => readExtendedTag(audioFile, options.includeProperties));
19
+ }
20
+ /**
21
+ * Applies metadata tag changes to an audio file and returns the modified content as a buffer.
22
+ *
23
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
24
+ * @param tags - Partial tag fields to merge with existing metadata
25
+ * @returns Modified audio file contents with updated tags
26
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
27
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
28
+ * @throws {FileOperationError} If saving the modified metadata fails
29
+ */
30
+ async function applyTags(file, tags) {
31
+ return withAudioFileSave(file, (audioFile) => {
32
+ mergeTagUpdates(audioFile, tags);
33
+ });
34
+ }
35
+ /**
36
+ * Writes metadata tag changes directly to an audio file on disk.
37
+ *
38
+ * @param file - File path string; the file is updated in place
39
+ * @param tags - Partial tag fields to merge with existing metadata
40
+ * @returns Resolves when the file has been written successfully
41
+ * @throws {FileOperationError} If a non-string input is provided, saving fails, or the file write fails
42
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
43
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
44
+ * @throws {EnvironmentError} If the runtime does not support filesystem write access
45
+ */
46
+ async function applyTagsToFile(file, tags) {
47
+ if (typeof file !== "string") throw new FileOperationError("save", "applyTagsToFile requires a file path string to save changes");
48
+ await withAudioFileSaveToFile(file, (audioFile) => {
49
+ mergeTagUpdates(audioFile, tags);
50
+ });
51
+ }
52
+ /**
53
+ * Reads audio properties (duration, bitrate, sample rate, channels) from an audio file.
54
+ *
55
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
56
+ * @returns Audio codec properties for the file
57
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
58
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
59
+ * @throws {MetadataError} If the file does not contain valid audio property data
60
+ */
61
+ async function readProperties(file) {
62
+ return withAudioFile(file, (audioFile) => {
63
+ const props = audioFile.audioProperties();
64
+ if (!props) throw new MetadataError("read", "File may not contain valid audio data", "audioProperties");
65
+ return props;
66
+ });
67
+ }
68
+ /**
69
+ * Checks whether the given input is a valid, readable audio file.
70
+ *
71
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
72
+ * @returns `true` if the file is valid and recognized by TagLib; `false` otherwise
73
+ */
74
+ async function isValidAudioFile(file) {
75
+ try {
76
+ const audioFile = await (await getTagLib()).open(file);
77
+ try {
78
+ return audioFile.isValid();
79
+ } finally {
80
+ audioFile.dispose();
81
+ }
82
+ } catch {
83
+ return false;
84
+ }
85
+ }
86
+ /**
87
+ * Detects the audio format of a file.
88
+ *
89
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
90
+ * @returns The detected `FileType`, or `undefined` if the format cannot be determined
91
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
92
+ */
93
+ async function readFormat(file) {
94
+ const audioFile = await (await getTagLib()).open(file);
95
+ try {
96
+ if (!audioFile.isValid()) return;
97
+ return audioFile.getFormat();
98
+ } finally {
99
+ audioFile.dispose();
100
+ }
101
+ }
102
+ /**
103
+ * Removes all metadata tags and pictures from an audio file and returns the stripped content.
104
+ *
105
+ * @param file - File path, Uint8Array, ArrayBuffer, or File object
106
+ * @returns Modified audio file contents with all tags and pictures cleared
107
+ * @throws {TagLibInitializationError} If the Wasm module fails to initialize
108
+ * @throws {InvalidFormatError} If the file is corrupted or in an unsupported format
109
+ * @throws {FileOperationError} If saving the modified metadata fails
110
+ */
111
+ async function clearTags(file) {
112
+ return withAudioFileSave(file, (audioFile) => {
113
+ const cleared = {};
114
+ for (const key of Object.keys(audioFile.properties())) cleared[key] = [];
115
+ audioFile.setProperties(cleared);
116
+ audioFile.removePictures();
117
+ audioFile.setLyrics([]);
118
+ audioFile.setRatings([]);
119
+ if (audioFile.getChapters().length > 0) audioFile.setChapters([]);
120
+ if (audioFile.getBextData() !== void 0) audioFile.setBextData(null);
121
+ if (audioFile.getIxml() !== void 0) audioFile.setIxml(null);
122
+ });
123
+ }
124
+ //#endregion
125
+ export { applyTags, applyTagsToFile, clearTags, isValidAudioFile, readFormat, readProperties, readTags };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with-audio-file.d.ts","sourceRoot":"","sources":["../../src/simple/with-audio-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/D,wBAAsB,aAAa,CAAC,CAAC,EACnC,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC5C,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,CAAC,CAAC,CAaZ;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GACjC,OAAO,CAAC,UAAU,CAAC,CAerB;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GACjC,OAAO,CAAC,IAAI,CAAC,CAKf"}
@@ -0,0 +1,28 @@
1
+ import { FileOperationError, InvalidFormatError } from "../errors/classes.js";
2
+ import "../errors.js";
3
+ import { getTagLib } from "./config.js";
4
+ //#region src/simple/with-audio-file.ts
5
+ async function withAudioFile(file, fn, options) {
6
+ const audioFile = await (await getTagLib()).open(file, options);
7
+ try {
8
+ if (!audioFile.isValid()) throw new InvalidFormatError("File may be corrupted or in an unsupported format");
9
+ return await fn(audioFile);
10
+ } finally {
11
+ audioFile.dispose();
12
+ }
13
+ }
14
+ async function withAudioFileSave(file, fn) {
15
+ return withAudioFile(file, (audioFile) => {
16
+ fn(audioFile);
17
+ if (!audioFile.save()) throw new FileOperationError("save", "Failed to save metadata changes. The file may be read-only or corrupted.");
18
+ return audioFile.getFileBuffer();
19
+ }, { partial: false });
20
+ }
21
+ async function withAudioFileSaveToFile(file, fn) {
22
+ return withAudioFile(file, async (audioFile) => {
23
+ fn(audioFile);
24
+ await audioFile.saveToFile(file);
25
+ });
26
+ }
27
+ //#endregion
28
+ export { withAudioFile, withAudioFileSave, withAudioFileSaveToFile };
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Simple API browser entry point.
3
- * The esbuild redirect plugin ensures the browser module loader is used.
3
+ * The browser build's redirect plugin ensures the browser module loader is used.
4
4
  *
5
5
  * @module simple/browser
6
6
  */
7
- export * from "./src/simple/index.js";
7
+ export * from "./simple/index.js";
8
8
  //# sourceMappingURL=simple.browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"simple.browser.d.ts","sourceRoot":"","sources":["../simple.browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"simple.browser.d.ts","sourceRoot":"","sources":["../src/simple.browser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,mBAAmB,CAAC"}