taglib-wasm 2.2.3 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +206 -21
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/assertClassBrand.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/checkPrivateRedeclaration.js +6 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldGet2.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldInitSpec.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldSet2.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js +12 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/toPrimitive.js +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/toPropertyKey.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/typeof.js +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/usingCtx.js +57 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/bwf/bext.d.ts.map +1 -0
- package/dist/bwf/bext.js +119 -0
- package/dist/{src/constants → constants}/additional-properties.d.ts.map +1 -1
- package/dist/constants/additional-properties.js +270 -0
- package/dist/constants/basic-properties.d.ts.map +1 -0
- package/dist/constants/basic-properties.js +128 -0
- package/dist/constants/complex-properties.d.ts.map +1 -0
- package/dist/constants/complex-properties.js +1 -0
- package/dist/constants/format-mappings.d.ts.map +1 -0
- package/dist/constants/format-mappings.js +58 -0
- package/dist/{src/constants → constants}/general-extended-properties.d.ts.map +1 -1
- package/dist/constants/general-extended-properties.js +272 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +5 -0
- package/dist/{src/constants → constants}/properties.d.ts +1 -1
- package/dist/constants/properties.d.ts.map +1 -0
- package/dist/constants/properties.js +105 -0
- package/dist/constants/property-types.d.ts.map +1 -0
- package/dist/constants/property-types.js +1 -0
- package/dist/{src/constants → constants}/specialized-properties.d.ts.map +1 -1
- package/dist/constants/specialized-properties.js +335 -0
- package/dist/{src/constants → constants}/utilities.d.ts +1 -1
- package/dist/constants/utilities.d.ts.map +1 -0
- package/dist/constants/utilities.js +50 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +5 -0
- package/dist/{src/deno-compile.d.ts → deno-compile.d.ts} +4 -2
- package/dist/deno-compile.d.ts.map +1 -0
- package/dist/deno-compile.js +109 -0
- package/dist/disc-folder.d.ts +4 -4
- package/dist/disc-folder.d.ts.map +1 -1
- package/dist/disc-folder.js +596 -544
- package/dist/errors/base.d.ts +38 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +66 -0
- package/dist/errors/classes.d.ts.map +1 -0
- package/dist/errors/classes.js +164 -0
- package/dist/errors/guards.d.ts.map +1 -0
- package/dist/errors/guards.js +26 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +5 -0
- package/dist/file-utils/copy-and-find.d.ts.map +1 -0
- package/dist/file-utils/copy-and-find.js +107 -0
- package/dist/file-utils/export-operations.d.ts.map +1 -0
- package/dist/file-utils/export-operations.js +84 -0
- package/dist/file-utils/import-operations.d.ts.map +1 -0
- package/dist/file-utils/import-operations.js +109 -0
- package/dist/file-utils/index.d.ts.map +1 -0
- package/dist/file-utils/index.js +5 -0
- package/dist/file-utils/mime-detection.d.ts.map +1 -0
- package/dist/file-utils/mime-detection.js +44 -0
- package/dist/folder-api/album-corroborate.d.ts.map +1 -0
- package/dist/folder-api/album-corroborate.js +35 -0
- package/dist/folder-api/album-discs.d.ts.map +1 -0
- package/dist/folder-api/album-discs.js +119 -0
- package/dist/folder-api/album-grouping.d.ts.map +1 -0
- package/dist/folder-api/album-grouping.js +161 -0
- package/dist/folder-api/album-identity.d.ts.map +1 -0
- package/dist/folder-api/album-identity.js +165 -0
- package/dist/folder-api/album-types.d.ts.map +1 -0
- package/dist/folder-api/album-types.js +1 -0
- package/dist/folder-api/directory-walker.d.ts.map +1 -0
- package/dist/folder-api/directory-walker.js +27 -0
- package/dist/folder-api/file-processors.d.ts.map +1 -0
- package/dist/folder-api/file-processors.js +52 -0
- package/dist/folder-api/folder-disc.d.ts.map +1 -0
- package/dist/folder-api/folder-disc.js +166 -0
- package/dist/folder-api/folder-operations.d.ts.map +1 -0
- package/dist/folder-api/folder-operations.js +69 -0
- package/dist/folder-api/index.d.ts.map +1 -0
- package/dist/{src/folder-api → folder-api}/index.js +1 -8
- package/dist/folder-api/scan-for-albums.d.ts.map +1 -0
- package/dist/folder-api/scan-for-albums.js +25 -0
- package/dist/folder-api/scan-operations.d.ts.map +1 -0
- package/dist/folder-api/scan-operations.js +79 -0
- package/dist/folder-api/types.d.ts.map +1 -0
- package/dist/folder-api/types.js +21 -0
- package/dist/folder.d.ts +1 -1
- package/dist/folder.d.ts.map +1 -1
- package/dist/folder.js +7 -2
- package/dist/global.d.js +1 -0
- package/dist/index.browser.d.ts +40 -21
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +4194 -3656
- package/dist/index.d.ts +26 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -183
- package/dist/msgpack/decoder.d.ts.map +1 -0
- package/dist/msgpack/decoder.js +177 -0
- package/dist/msgpack/encoder.d.ts.map +1 -0
- package/dist/msgpack/encoder.js +211 -0
- package/dist/msgpack/index.d.ts.map +1 -0
- package/dist/msgpack/index.js +5 -0
- package/dist/{src/msgpack → msgpack}/types.d.ts +1 -1
- package/dist/msgpack/types.d.ts.map +1 -0
- package/dist/msgpack/types.js +13 -0
- package/dist/msgpack/utils.d.ts.map +1 -0
- package/dist/msgpack/utils.js +116 -0
- package/dist/rating.d.ts +1 -1
- package/dist/rating.d.ts.map +1 -1
- package/dist/rating.js +2 -2
- package/dist/runtime/deno-detect.d.ts.map +1 -0
- package/dist/runtime/deno-detect.js +12 -0
- package/dist/{src/runtime → runtime}/detector.d.ts +2 -0
- package/dist/runtime/detector.d.ts.map +1 -0
- package/dist/runtime/detector.js +173 -0
- package/dist/runtime/loader-types.d.ts.map +1 -0
- package/dist/runtime/loader-types.js +23 -0
- package/dist/runtime/module-loader-browser.d.ts.map +1 -0
- package/dist/runtime/module-loader-browser.js +33 -0
- package/dist/runtime/module-loader.d.ts.map +1 -0
- package/dist/runtime/module-loader.js +119 -0
- package/dist/runtime/platform-io.d.ts.map +1 -0
- package/dist/runtime/platform-io.js +153 -0
- package/dist/runtime/unified-loader/index.d.ts.map +1 -0
- package/dist/{src/runtime → runtime}/unified-loader/index.js +1 -7
- package/dist/runtime/unified-loader/loader.d.ts.map +1 -0
- package/dist/runtime/unified-loader/loader.js +64 -0
- package/dist/runtime/unified-loader/module-loading.d.ts.map +1 -0
- package/dist/runtime/unified-loader/module-loading.js +90 -0
- package/dist/runtime/unified-loader/module-selection.d.ts.map +1 -0
- package/dist/runtime/unified-loader/module-selection.js +25 -0
- package/dist/runtime/unified-loader/types.d.ts.map +1 -0
- package/dist/runtime/unified-loader/types.js +24 -0
- package/dist/{src/runtime → runtime}/wasi-adapter/adapter.d.ts +13 -1
- package/dist/runtime/wasi-adapter/adapter.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/adapter.js +114 -0
- package/dist/{src/runtime → runtime}/wasi-adapter/audio-properties.d.ts +4 -1
- package/dist/runtime/wasi-adapter/audio-properties.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/audio-properties.js +120 -0
- package/dist/runtime/wasi-adapter/file-handle.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/file-handle.js +181 -0
- package/dist/runtime/wasi-adapter/handle-state.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/handle-state.js +48 -0
- package/dist/runtime/wasi-adapter/index.d.ts.map +1 -0
- package/dist/{src/runtime → runtime}/wasi-adapter/index.js +1 -3
- package/dist/runtime/wasi-adapter/mp4-items.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/mp4-items.js +97 -0
- package/dist/runtime/wasi-adapter/path-open.d.ts +68 -0
- package/dist/runtime/wasi-adapter/path-open.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/path-open.js +101 -0
- package/dist/runtime/wasi-adapter/property-surface.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/property-surface.js +96 -0
- package/dist/runtime/wasi-adapter/structured-fields.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/structured-fields.js +144 -0
- package/dist/runtime/wasi-adapter/tag-keys.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/tag-keys.js +65 -0
- package/dist/runtime/wasi-adapter/wasm-io.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/wasm-io.js +154 -0
- package/dist/runtime/wasi-fs-deno.d.ts.map +1 -0
- package/dist/runtime/wasi-fs-deno.js +25 -0
- package/dist/runtime/wasi-fs-node.d.ts.map +1 -0
- package/dist/runtime/wasi-fs-node.js +58 -0
- package/dist/runtime/wasi-fs-provider.d.ts.map +1 -0
- package/dist/runtime/wasi-fs-provider.js +1 -0
- package/dist/runtime/wasi-host-loader.d.ts.map +1 -0
- package/dist/runtime/wasi-host-loader.js +101 -0
- package/dist/runtime/wasi-host.d.ts.map +1 -0
- package/dist/runtime/wasi-host.js +199 -0
- package/dist/runtime/wasi-memory.d.ts.map +1 -0
- package/dist/runtime/wasi-memory.js +179 -0
- package/dist/{src/runtime → runtime}/wasmer-sdk-loader/types.d.ts +13 -0
- package/dist/runtime/wasmer-sdk-loader/types.d.ts.map +1 -0
- package/dist/runtime/wasmer-sdk-loader/types.js +15 -0
- package/dist/simple/batch-operations.d.ts.map +1 -0
- package/dist/simple/batch-operations.js +245 -0
- package/dist/simple/checksum-operations.d.ts +25 -0
- package/dist/simple/checksum-operations.d.ts.map +1 -0
- package/dist/simple/checksum-operations.js +28 -0
- package/dist/simple/config.d.ts.map +1 -0
- package/dist/simple/config.js +17 -0
- package/dist/{src/simple → simple}/index.d.ts +2 -0
- package/dist/simple/index.d.ts.map +1 -0
- package/dist/simple/index.js +8 -0
- package/dist/simple/picture-operations.d.ts.map +1 -0
- package/dist/simple/picture-operations.js +132 -0
- package/dist/simple/tag-operations.d.ts.map +1 -0
- package/dist/simple/tag-operations.js +125 -0
- package/dist/simple/with-audio-file.d.ts.map +1 -0
- package/dist/simple/with-audio-file.js +28 -0
- package/dist/simple.browser.d.ts +2 -2
- package/dist/simple.browser.d.ts.map +1 -1
- package/dist/simple.browser.js +3462 -3425
- package/dist/simple.d.ts +1 -1
- package/dist/simple.d.ts.map +1 -1
- package/dist/simple.js +8 -2
- package/dist/taglib/audio-file-base.d.ts.map +1 -0
- package/dist/taglib/audio-file-base.js +166 -0
- package/dist/taglib/audio-file-bwf.d.ts.map +1 -0
- package/dist/taglib/audio-file-bwf.js +33 -0
- package/dist/taglib/audio-file-checksum.d.ts +47 -0
- package/dist/taglib/audio-file-checksum.d.ts.map +1 -0
- package/dist/taglib/audio-file-checksum.js +90 -0
- package/dist/{src/taglib → taglib}/audio-file-impl.d.ts +4 -0
- package/dist/taglib/audio-file-impl.d.ts.map +1 -0
- package/dist/taglib/audio-file-impl.js +234 -0
- package/dist/{src/taglib → taglib}/audio-file-interface.d.ts +17 -0
- package/dist/taglib/audio-file-interface.d.ts.map +1 -0
- package/dist/taglib/audio-file-interface.js +1 -0
- package/dist/taglib/auto-dispose.d.ts.map +1 -0
- package/dist/taglib/auto-dispose.js +34 -0
- package/dist/taglib/embind-adapter.d.ts.map +1 -0
- package/dist/taglib/embind-adapter.js +137 -0
- package/dist/taglib/extra-state-registry.d.ts.map +1 -0
- package/dist/taglib/extra-state-registry.js +72 -0
- package/dist/{src/taglib → taglib}/id3v2-frames.d.ts +0 -1
- package/dist/taglib/id3v2-frames.d.ts.map +1 -0
- package/dist/taglib/id3v2-frames.js +25 -0
- package/dist/taglib/index.d.ts.map +1 -0
- package/dist/taglib/index.js +7 -0
- package/dist/taglib/load-audio-data.d.ts.map +1 -0
- package/dist/taglib/load-audio-data.js +54 -0
- package/dist/taglib/media-ranges.d.ts +85 -0
- package/dist/taglib/media-ranges.d.ts.map +1 -0
- package/dist/taglib/media-ranges.js +309 -0
- package/dist/taglib/metadata-extent.d.ts +96 -0
- package/dist/taglib/metadata-extent.d.ts.map +1 -0
- package/dist/taglib/metadata-extent.js +394 -0
- package/dist/taglib/mp4-item-names.d.ts.map +1 -0
- package/dist/taglib/mp4-item-names.js +14 -0
- package/dist/taglib/mutable-tag-impl.d.ts.map +1 -0
- package/dist/taglib/mutable-tag-impl.js +81 -0
- package/dist/taglib/mutable-tag.d.ts.map +1 -0
- package/dist/taglib/mutable-tag.js +1 -0
- package/dist/taglib/save-reconstruct.d.ts.map +1 -0
- package/dist/taglib/save-reconstruct.js +53 -0
- package/dist/taglib/taglib-class.d.ts.map +1 -0
- package/dist/taglib/taglib-class.js +146 -0
- package/dist/taglib-wasi.wasm +0 -0
- package/dist/taglib-web.wasm +0 -0
- package/dist/taglib-wrapper.js +1 -1
- package/dist/taglib.d.ts.map +1 -0
- package/dist/taglib.js +7 -0
- package/dist/types/audio-formats.d.ts.map +1 -0
- package/dist/types/audio-formats.js +6 -0
- package/dist/types/bwf.d.ts.map +1 -0
- package/dist/types/bwf.js +1 -0
- package/dist/types/chapters.d.ts.map +1 -0
- package/dist/types/chapters.js +1 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +1 -0
- package/dist/types/format-property-keys.d.ts.map +1 -0
- package/dist/types/format-property-keys.js +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/metadata-mappings.d.ts.map +1 -0
- package/dist/types/metadata-mappings.js +323 -0
- package/dist/types/pictures.d.ts.map +1 -0
- package/dist/types/pictures.js +79 -0
- package/dist/types/tags.d.ts.map +1 -0
- package/dist/types/tags.js +1 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +43 -0
- package/dist/utils/mirror-fields.d.ts.map +1 -0
- package/dist/utils/mirror-fields.js +107 -0
- package/dist/utils/node-fs.d.ts.map +1 -0
- package/dist/utils/node-fs.js +36 -0
- package/dist/utils/path.d.ts +26 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +52 -0
- package/dist/utils/rating.d.ts.map +1 -0
- package/dist/utils/rating.js +150 -0
- package/dist/utils/tag-mapping.d.ts.map +1 -0
- package/dist/utils/tag-mapping.js +207 -0
- package/dist/utils/write.d.ts.map +1 -0
- package/dist/utils/write.js +18 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +4 -0
- package/dist/{src/wasm.d.ts → wasm.d.ts} +9 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +1 -0
- package/dist/web-utils/canvas.d.ts.map +1 -0
- package/dist/web-utils/canvas.js +97 -0
- package/dist/web-utils/data-url.d.ts.map +1 -0
- package/dist/web-utils/data-url.js +54 -0
- package/dist/web-utils/dom-integration.d.ts.map +1 -0
- package/dist/web-utils/dom-integration.js +105 -0
- package/dist/web-utils/index.d.ts.map +1 -0
- package/dist/web-utils/index.js +4 -0
- package/dist/web.browser.d.ts +13 -0
- package/dist/web.browser.d.ts.map +1 -0
- package/dist/web.browser.js +3387 -0
- package/dist/web.d.ts +1 -1
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +5 -2
- package/package.json +140 -97
- package/dist/src/bwf/bext.d.ts.map +0 -1
- package/dist/src/bwf/bext.js +0 -126
- package/dist/src/constants/additional-properties.js +0 -204
- package/dist/src/constants/basic-properties.d.ts.map +0 -1
- package/dist/src/constants/basic-properties.js +0 -89
- package/dist/src/constants/complex-properties.d.ts.map +0 -1
- package/dist/src/constants/complex-properties.js +0 -0
- package/dist/src/constants/format-mappings.d.ts.map +0 -1
- package/dist/src/constants/format-mappings.js +0 -54
- package/dist/src/constants/general-extended-properties.js +0 -254
- package/dist/src/constants/index.d.ts.map +0 -1
- package/dist/src/constants/index.js +0 -4
- package/dist/src/constants/properties.d.ts.map +0 -1
- package/dist/src/constants/properties.js +0 -95
- package/dist/src/constants/property-types.d.ts.map +0 -1
- package/dist/src/constants/property-types.js +0 -0
- package/dist/src/constants/specialized-properties.js +0 -223
- package/dist/src/constants/utilities.d.ts.map +0 -1
- package/dist/src/constants/utilities.js +0 -33
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -1
- package/dist/src/deno-compile.d.ts.map +0 -1
- package/dist/src/deno-compile.js +0 -75
- package/dist/src/errors/base.d.ts +0 -23
- package/dist/src/errors/base.d.ts.map +0 -1
- package/dist/src/errors/base.js +0 -31
- package/dist/src/errors/classes.d.ts.map +0 -1
- package/dist/src/errors/classes.js +0 -170
- package/dist/src/errors/guards.d.ts.map +0 -1
- package/dist/src/errors/guards.js +0 -39
- package/dist/src/errors/index.d.ts.map +0 -1
- package/dist/src/errors/index.js +0 -39
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js +0 -1
- package/dist/src/file-utils/copy-and-find.d.ts.map +0 -1
- package/dist/src/file-utils/copy-and-find.js +0 -89
- package/dist/src/file-utils/export-operations.d.ts.map +0 -1
- package/dist/src/file-utils/export-operations.js +0 -40
- package/dist/src/file-utils/import-operations.d.ts.map +0 -1
- package/dist/src/file-utils/import-operations.js +0 -42
- package/dist/src/file-utils/index.d.ts.map +0 -1
- package/dist/src/file-utils/index.js +0 -26
- package/dist/src/file-utils/mime-detection.d.ts.map +0 -1
- package/dist/src/file-utils/mime-detection.js +0 -45
- package/dist/src/folder-api/album-corroborate.d.ts.map +0 -1
- package/dist/src/folder-api/album-corroborate.js +0 -36
- package/dist/src/folder-api/album-discs.d.ts.map +0 -1
- package/dist/src/folder-api/album-discs.js +0 -122
- package/dist/src/folder-api/album-grouping.d.ts.map +0 -1
- package/dist/src/folder-api/album-grouping.js +0 -118
- package/dist/src/folder-api/album-identity.d.ts.map +0 -1
- package/dist/src/folder-api/album-identity.js +0 -151
- package/dist/src/folder-api/album-types.d.ts.map +0 -1
- package/dist/src/folder-api/album-types.js +0 -0
- package/dist/src/folder-api/directory-walker.d.ts.map +0 -1
- package/dist/src/folder-api/directory-walker.js +0 -35
- package/dist/src/folder-api/file-processors.d.ts.map +0 -1
- package/dist/src/folder-api/file-processors.js +0 -63
- package/dist/src/folder-api/folder-disc.d.ts.map +0 -1
- package/dist/src/folder-api/folder-disc.js +0 -169
- package/dist/src/folder-api/folder-operations.d.ts.map +0 -1
- package/dist/src/folder-api/folder-operations.js +0 -54
- package/dist/src/folder-api/index.d.ts.map +0 -1
- package/dist/src/folder-api/scan-for-albums.d.ts.map +0 -1
- package/dist/src/folder-api/scan-for-albums.js +0 -20
- package/dist/src/folder-api/scan-operations.d.ts.map +0 -1
- package/dist/src/folder-api/scan-operations.js +0 -77
- package/dist/src/folder-api/types.d.ts.map +0 -1
- package/dist/src/folder-api/types.js +0 -21
- package/dist/src/msgpack/decoder.d.ts.map +0 -1
- package/dist/src/msgpack/decoder.js +0 -215
- package/dist/src/msgpack/encoder.d.ts.map +0 -1
- package/dist/src/msgpack/encoder.js +0 -249
- package/dist/src/msgpack/index.d.ts.map +0 -1
- package/dist/src/msgpack/index.js +0 -56
- package/dist/src/msgpack/types.d.ts.map +0 -1
- package/dist/src/msgpack/types.js +0 -12
- package/dist/src/msgpack/utils.d.ts.map +0 -1
- package/dist/src/msgpack/utils.js +0 -134
- package/dist/src/runtime/deno-detect.d.ts.map +0 -1
- package/dist/src/runtime/deno-detect.js +0 -6
- package/dist/src/runtime/detector.d.ts.map +0 -1
- package/dist/src/runtime/detector.js +0 -181
- package/dist/src/runtime/loader-types.d.ts.map +0 -1
- package/dist/src/runtime/loader-types.js +0 -10
- package/dist/src/runtime/module-loader-browser.d.ts.map +0 -1
- package/dist/src/runtime/module-loader-browser.js +0 -37
- package/dist/src/runtime/module-loader.d.ts.map +0 -1
- package/dist/src/runtime/module-loader.js +0 -119
- package/dist/src/runtime/platform-io.d.ts.map +0 -1
- package/dist/src/runtime/platform-io.js +0 -188
- package/dist/src/runtime/unified-loader/index.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/loader.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/loader.js +0 -84
- package/dist/src/runtime/unified-loader/module-loading.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/module-loading.js +0 -122
- package/dist/src/runtime/unified-loader/module-selection.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/module-selection.js +0 -41
- package/dist/src/runtime/unified-loader/types.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/types.js +0 -25
- package/dist/src/runtime/wasi-adapter/adapter.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/adapter.js +0 -113
- package/dist/src/runtime/wasi-adapter/audio-properties.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/audio-properties.js +0 -85
- package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/file-handle.js +0 -197
- package/dist/src/runtime/wasi-adapter/handle-state.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/handle-state.js +0 -58
- package/dist/src/runtime/wasi-adapter/index.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/mp4-items.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/mp4-items.js +0 -80
- package/dist/src/runtime/wasi-adapter/property-surface.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/property-surface.js +0 -104
- package/dist/src/runtime/wasi-adapter/structured-fields.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/structured-fields.js +0 -139
- package/dist/src/runtime/wasi-adapter/tag-keys.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/tag-keys.js +0 -46
- package/dist/src/runtime/wasi-adapter/wasm-io.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/wasm-io.js +0 -249
- package/dist/src/runtime/wasi-fs-deno.d.ts.map +0 -1
- package/dist/src/runtime/wasi-fs-deno.js +0 -26
- package/dist/src/runtime/wasi-fs-node.d.ts.map +0 -1
- package/dist/src/runtime/wasi-fs-node.js +0 -66
- package/dist/src/runtime/wasi-fs-provider.d.ts.map +0 -1
- package/dist/src/runtime/wasi-fs-provider.js +0 -0
- package/dist/src/runtime/wasi-host-loader.d.ts.map +0 -1
- package/dist/src/runtime/wasi-host-loader.js +0 -109
- package/dist/src/runtime/wasi-host.d.ts.map +0 -1
- package/dist/src/runtime/wasi-host.js +0 -202
- package/dist/src/runtime/wasi-memory.d.ts.map +0 -1
- package/dist/src/runtime/wasi-memory.js +0 -197
- package/dist/src/runtime/wasmer-sdk-loader/types.d.ts.map +0 -1
- package/dist/src/runtime/wasmer-sdk-loader/types.js +0 -12
- package/dist/src/simple/batch-operations.d.ts.map +0 -1
- package/dist/src/simple/batch-operations.js +0 -186
- package/dist/src/simple/config.d.ts.map +0 -1
- package/dist/src/simple/config.js +0 -18
- package/dist/src/simple/index.d.ts.map +0 -1
- package/dist/src/simple/index.js +0 -58
- package/dist/src/simple/picture-operations.d.ts.map +0 -1
- package/dist/src/simple/picture-operations.js +0 -68
- package/dist/src/simple/tag-operations.d.ts.map +0 -1
- package/dist/src/simple/tag-operations.js +0 -90
- package/dist/src/simple/with-audio-file.d.ts.map +0 -1
- package/dist/src/simple/with-audio-file.js +0 -39
- package/dist/src/taglib/audio-file-base.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-base.js +0 -187
- package/dist/src/taglib/audio-file-bwf.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-bwf.js +0 -41
- package/dist/src/taglib/audio-file-impl.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-impl.js +0 -285
- package/dist/src/taglib/audio-file-interface.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-interface.js +0 -0
- package/dist/src/taglib/auto-dispose.d.ts.map +0 -1
- package/dist/src/taglib/auto-dispose.js +0 -13
- package/dist/src/taglib/embind-adapter.d.ts.map +0 -1
- package/dist/src/taglib/embind-adapter.js +0 -141
- package/dist/src/taglib/extra-state-registry.d.ts.map +0 -1
- package/dist/src/taglib/extra-state-registry.js +0 -78
- package/dist/src/taglib/id3v2-frames.d.ts.map +0 -1
- package/dist/src/taglib/id3v2-frames.js +0 -42
- package/dist/src/taglib/index.d.ts.map +0 -1
- package/dist/src/taglib/index.js +0 -41
- package/dist/src/taglib/load-audio-data.d.ts.map +0 -1
- package/dist/src/taglib/load-audio-data.js +0 -51
- package/dist/src/taglib/metadata-extent.d.ts +0 -41
- package/dist/src/taglib/metadata-extent.d.ts.map +0 -1
- package/dist/src/taglib/metadata-extent.js +0 -171
- package/dist/src/taglib/mp4-item-names.d.ts.map +0 -1
- package/dist/src/taglib/mp4-item-names.js +0 -4
- package/dist/src/taglib/mutable-tag-impl.d.ts.map +0 -1
- package/dist/src/taglib/mutable-tag-impl.js +0 -88
- package/dist/src/taglib/mutable-tag.d.ts.map +0 -1
- package/dist/src/taglib/mutable-tag.js +0 -0
- package/dist/src/taglib/save-reconstruct.d.ts.map +0 -1
- package/dist/src/taglib/save-reconstruct.js +0 -43
- package/dist/src/taglib/taglib-class.d.ts.map +0 -1
- package/dist/src/taglib/taglib-class.js +0 -206
- package/dist/src/taglib.d.ts.map +0 -1
- package/dist/src/taglib.js +0 -1
- package/dist/src/types/audio-formats.d.ts.map +0 -1
- package/dist/src/types/audio-formats.js +0 -6
- package/dist/src/types/bwf.d.ts.map +0 -1
- package/dist/src/types/bwf.js +0 -0
- package/dist/src/types/chapters.d.ts.map +0 -1
- package/dist/src/types/chapters.js +0 -0
- package/dist/src/types/config.d.ts.map +0 -1
- package/dist/src/types/config.js +0 -0
- package/dist/src/types/format-property-keys.d.ts.map +0 -1
- package/dist/src/types/format-property-keys.js +0 -0
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/index.js +0 -8
- package/dist/src/types/metadata-mappings.d.ts.map +0 -1
- package/dist/src/types/metadata-mappings.js +0 -252
- package/dist/src/types/pictures.d.ts.map +0 -1
- package/dist/src/types/pictures.js +0 -64
- package/dist/src/types/tags.d.ts.map +0 -1
- package/dist/src/types/tags.js +0 -0
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -1
- package/dist/src/utils/file.d.ts.map +0 -1
- package/dist/src/utils/file.js +0 -52
- package/dist/src/utils/mirror-fields.d.ts.map +0 -1
- package/dist/src/utils/mirror-fields.js +0 -75
- package/dist/src/utils/node-fs.d.ts.map +0 -1
- package/dist/src/utils/node-fs.js +0 -22
- package/dist/src/utils/path.d.ts +0 -14
- package/dist/src/utils/path.d.ts.map +0 -1
- package/dist/src/utils/path.js +0 -17
- package/dist/src/utils/rating.d.ts.map +0 -1
- package/dist/src/utils/rating.js +0 -73
- package/dist/src/utils/tag-mapping.d.ts.map +0 -1
- package/dist/src/utils/tag-mapping.js +0 -214
- package/dist/src/utils/write.d.ts.map +0 -1
- package/dist/src/utils/write.js +0 -17
- package/dist/src/version.d.ts +0 -2
- package/dist/src/version.d.ts.map +0 -1
- package/dist/src/version.js +0 -4
- package/dist/src/wasm.d.ts.map +0 -1
- package/dist/src/wasm.js +0 -0
- package/dist/src/web-utils/canvas.d.ts.map +0 -1
- package/dist/src/web-utils/canvas.js +0 -60
- package/dist/src/web-utils/data-url.d.ts.map +0 -1
- package/dist/src/web-utils/data-url.js +0 -34
- package/dist/src/web-utils/dom-integration.d.ts.map +0 -1
- package/dist/src/web-utils/dom-integration.js +0 -53
- package/dist/src/web-utils/index.d.ts.map +0 -1
- package/dist/src/web-utils/index.js +0 -21
- /package/dist/{src/bwf → bwf}/bext.d.ts +0 -0
- /package/dist/{src/constants → constants}/additional-properties.d.ts +0 -0
- /package/dist/{src/constants → constants}/basic-properties.d.ts +0 -0
- /package/dist/{src/constants → constants}/complex-properties.d.ts +0 -0
- /package/dist/{src/constants → constants}/format-mappings.d.ts +0 -0
- /package/dist/{src/constants → constants}/general-extended-properties.d.ts +0 -0
- /package/dist/{src/constants → constants}/index.d.ts +0 -0
- /package/dist/{src/constants → constants}/property-types.d.ts +0 -0
- /package/dist/{src/constants → constants}/specialized-properties.d.ts +0 -0
- /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{src/errors → errors}/classes.d.ts +0 -0
- /package/dist/{src/errors → errors}/guards.d.ts +0 -0
- /package/dist/{src/errors → errors}/index.d.ts +0 -0
- /package/dist/{src/errors.d.ts → errors.d.ts} +0 -0
- /package/dist/{src/file-utils → file-utils}/copy-and-find.d.ts +0 -0
- /package/dist/{src/file-utils → file-utils}/export-operations.d.ts +0 -0
- /package/dist/{src/file-utils → file-utils}/import-operations.d.ts +0 -0
- /package/dist/{src/file-utils → file-utils}/index.d.ts +0 -0
- /package/dist/{src/file-utils → file-utils}/mime-detection.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-corroborate.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-discs.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-grouping.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-identity.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-types.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/directory-walker.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/file-processors.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/folder-disc.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/folder-operations.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/index.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/scan-for-albums.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/scan-operations.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/types.d.ts +0 -0
- /package/dist/{src/msgpack → msgpack}/decoder.d.ts +0 -0
- /package/dist/{src/msgpack → msgpack}/encoder.d.ts +0 -0
- /package/dist/{src/msgpack → msgpack}/index.d.ts +0 -0
- /package/dist/{src/msgpack → msgpack}/utils.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/deno-detect.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/loader-types.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/module-loader-browser.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/module-loader.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/platform-io.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/index.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/loader.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/module-loading.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/module-selection.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/types.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/file-handle.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/handle-state.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/index.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/mp4-items.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/property-surface.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/structured-fields.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/tag-keys.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/wasm-io.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-fs-deno.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-fs-node.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-fs-provider.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-host-loader.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-host.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-memory.d.ts +0 -0
- /package/dist/{src/simple → simple}/batch-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/config.d.ts +0 -0
- /package/dist/{src/simple → simple}/picture-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/tag-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/with-audio-file.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-base.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-bwf.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/auto-dispose.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/embind-adapter.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/extra-state-registry.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/index.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/load-audio-data.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/mp4-item-names.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/mutable-tag-impl.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/mutable-tag.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/save-reconstruct.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/taglib-class.d.ts +0 -0
- /package/dist/{src/taglib.d.ts → taglib.d.ts} +0 -0
- /package/dist/{src/types → types}/audio-formats.d.ts +0 -0
- /package/dist/{src/types → types}/bwf.d.ts +0 -0
- /package/dist/{src/types → types}/chapters.d.ts +0 -0
- /package/dist/{src/types → types}/config.d.ts +0 -0
- /package/dist/{src/types → types}/format-property-keys.d.ts +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
- /package/dist/{src/types → types}/metadata-mappings.d.ts +0 -0
- /package/dist/{src/types → types}/pictures.d.ts +0 -0
- /package/dist/{src/types → types}/tags.d.ts +0 -0
- /package/dist/{src/types.d.ts → types.d.ts} +0 -0
- /package/dist/{src/utils → utils}/file.d.ts +0 -0
- /package/dist/{src/utils → utils}/mirror-fields.d.ts +0 -0
- /package/dist/{src/utils → utils}/node-fs.d.ts +0 -0
- /package/dist/{src/utils → utils}/rating.d.ts +0 -0
- /package/dist/{src/utils → utils}/tag-mapping.d.ts +0 -0
- /package/dist/{src/utils → utils}/write.d.ts +0 -0
- /package/dist/{src/web-utils → web-utils}/canvas.d.ts +0 -0
- /package/dist/{src/web-utils → web-utils}/data-url.d.ts +0 -0
- /package/dist/{src/web-utils → web-utils}/dom-integration.d.ts +0 -0
- /package/dist/{src/web-utils → web-utils}/index.d.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of audio formats supported by TagLib-Wasm.
|
|
3
|
+
*
|
|
4
|
+
* The prose source of truth is the README's "Supported Formats" section; this
|
|
5
|
+
* list carries every `FileType` member except `"unknown"` (src/types/audio-
|
|
6
|
+
* formats.ts), plus the extension aliases files actually carry ("M4A", "MKA")
|
|
7
|
+
* — ASF is the container of the WMA flavour the README names.
|
|
8
|
+
*
|
|
9
|
+
* Public contract: the default `supportedFormats` on `UnsupportedFormatError`
|
|
10
|
+
* (src/errors/classes.ts), and part of that error's message.
|
|
11
|
+
*
|
|
12
|
+
* This is the formats the library can read, not a promise that both backends
|
|
13
|
+
* describe all of them identically. Measured 2026-09-18 (taglib-uat8):
|
|
14
|
+
* `getFormat()` answers every member on both backends, but on Emscripten
|
|
15
|
+
* `audioProperties().containerFormat` / `.codec` still report `"unknown"` for
|
|
16
|
+
* the formats the embind sniffer cannot place (APE, DSF, DSDIFF, MPC, SHN,
|
|
17
|
+
* MOD, S3M, IT, XM); their tags and the rest of their properties load.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SUPPORTED_FORMATS: readonly ["MP3", "AAC", "MP4", "M4A", "FLAC", "OGG", "OPUS", "OggFLAC", "SPEEX", "WAV", "AIFF", "ASF", "APE", "DSF", "DSDIFF", "WV", "MPC", "TTA", "SHN", "MOD", "S3M", "IT", "XM", "MATROSKA", "MKA"];
|
|
20
|
+
/**
|
|
21
|
+
* Error codes for programmatic error handling
|
|
22
|
+
*/
|
|
23
|
+
export type TagLibErrorCode = "INITIALIZATION" | "INVALID_FORMAT" | "UNSUPPORTED_FORMAT" | "FILE_OPERATION" | "METADATA" | "MEMORY" | "ENVIRONMENT" | "WASM_MEMORY" | "MODULE_LOAD" | "WASI_HOST";
|
|
24
|
+
/**
|
|
25
|
+
* Base error class for all TagLib-Wasm errors
|
|
26
|
+
*/
|
|
27
|
+
export declare class TagLibError extends Error {
|
|
28
|
+
readonly code: TagLibErrorCode;
|
|
29
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new TagLibError
|
|
32
|
+
* @param code - Error code for programmatic handling
|
|
33
|
+
* @param message - Human-readable error message
|
|
34
|
+
* @param details - Additional context about the error
|
|
35
|
+
*/
|
|
36
|
+
constructor(code: TagLibErrorCode, message: string, details?: Record<string, unknown> | undefined);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/errors/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,wMA0BpB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,gBAAgB,GAChB,gBAAgB,GAChB,oBAAoB,GACpB,gBAAgB,GAChB,UAAU,GACV,QAAQ,GACR,aAAa,GACb,aAAa,GACb,aAAa,GACb,WAAW,CAAC;AAEhB;;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"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/errors/base.ts
|
|
2
|
+
/**
|
|
3
|
+
* List of audio formats supported by TagLib-Wasm.
|
|
4
|
+
*
|
|
5
|
+
* The prose source of truth is the README's "Supported Formats" section; this
|
|
6
|
+
* list carries every `FileType` member except `"unknown"` (src/types/audio-
|
|
7
|
+
* formats.ts), plus the extension aliases files actually carry ("M4A", "MKA")
|
|
8
|
+
* — ASF is the container of the WMA flavour the README names.
|
|
9
|
+
*
|
|
10
|
+
* Public contract: the default `supportedFormats` on `UnsupportedFormatError`
|
|
11
|
+
* (src/errors/classes.ts), and part of that error's message.
|
|
12
|
+
*
|
|
13
|
+
* This is the formats the library can read, not a promise that both backends
|
|
14
|
+
* describe all of them identically. Measured 2026-09-18 (taglib-uat8):
|
|
15
|
+
* `getFormat()` answers every member on both backends, but on Emscripten
|
|
16
|
+
* `audioProperties().containerFormat` / `.codec` still report `"unknown"` for
|
|
17
|
+
* the formats the embind sniffer cannot place (APE, DSF, DSDIFF, MPC, SHN,
|
|
18
|
+
* MOD, S3M, IT, XM); their tags and the rest of their properties load.
|
|
19
|
+
*/
|
|
20
|
+
const SUPPORTED_FORMATS = [
|
|
21
|
+
"MP3",
|
|
22
|
+
"AAC",
|
|
23
|
+
"MP4",
|
|
24
|
+
"M4A",
|
|
25
|
+
"FLAC",
|
|
26
|
+
"OGG",
|
|
27
|
+
"OPUS",
|
|
28
|
+
"OggFLAC",
|
|
29
|
+
"SPEEX",
|
|
30
|
+
"WAV",
|
|
31
|
+
"AIFF",
|
|
32
|
+
"ASF",
|
|
33
|
+
"APE",
|
|
34
|
+
"DSF",
|
|
35
|
+
"DSDIFF",
|
|
36
|
+
"WV",
|
|
37
|
+
"MPC",
|
|
38
|
+
"TTA",
|
|
39
|
+
"SHN",
|
|
40
|
+
"MOD",
|
|
41
|
+
"S3M",
|
|
42
|
+
"IT",
|
|
43
|
+
"XM",
|
|
44
|
+
"MATROSKA",
|
|
45
|
+
"MKA"
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Base error class for all TagLib-Wasm errors
|
|
49
|
+
*/
|
|
50
|
+
var TagLibError = class TagLibError extends Error {
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new TagLibError
|
|
53
|
+
* @param code - Error code for programmatic handling
|
|
54
|
+
* @param message - Human-readable error message
|
|
55
|
+
* @param details - Additional context about the error
|
|
56
|
+
*/
|
|
57
|
+
constructor(code, message, details) {
|
|
58
|
+
super(message);
|
|
59
|
+
this.code = code;
|
|
60
|
+
this.details = details;
|
|
61
|
+
this.name = "TagLibError";
|
|
62
|
+
Object.setPrototypeOf(this, TagLibError.prototype);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { SUPPORTED_FORMATS, TagLibError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.d.ts","sourceRoot":"","sources":["../../src/errors/classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,WAAW,EAAE,MAAM,WAAW,CAAC;AAE3D,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD;AAYD;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,WAAW;IACxD;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAS/D;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;aAS/B,UAAU,CAAC,EAAE,MAAM;IARrC;;;;;OAKG;gBAED,OAAO,EAAE,MAAM,EACC,UAAU,CAAC,EAAE,MAAM,YAAA,EACnC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAoBpC;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,WAAW;aAQnC,MAAM,EAAE,MAAM;aACd,gBAAgB,EAAE,SAAS,MAAM,EAAE;IARrD;;;;;OAKG;gBAEe,MAAM,EAAE,MAAM,EACd,gBAAgB,GAAE,SAAS,MAAM,EAAsB,EACvE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAYpC;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;aAS/B,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM;aAE7C,IAAI,CAAC,EAAE,MAAM;IAV/B;;;;;;OAMG;gBAEe,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,EAC7D,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,YAAA,EAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAgBpC;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;aAS1B,SAAS,EAAE,MAAM,GAAG,OAAO;aAE3B,KAAK,CAAC,EAAE,MAAM;IAVhC;;;;;;OAMG;gBAEe,SAAS,EAAE,MAAM,GAAG,OAAO,EAC3C,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,MAAM,YAAA,EAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAgBpC;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAS/D;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;aAQ7B,WAAW,EAAE,MAAM;aACnB,MAAM,EAAE,MAAM;aACd,eAAe,CAAC,EAAE,MAAM;IAT1C;;;;;OAKG;gBAEe,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,YAAA;CAS3C"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { SUPPORTED_FORMATS, TagLibError } from "./base.js";
|
|
2
|
+
//#region src/errors/classes.ts
|
|
3
|
+
function errorMessage(error) {
|
|
4
|
+
return error instanceof Error ? error.message : String(error);
|
|
5
|
+
}
|
|
6
|
+
function createErrorMessage(prefix, details) {
|
|
7
|
+
return `${prefix}: ${details}`;
|
|
8
|
+
}
|
|
9
|
+
function formatFileSize(bytes) {
|
|
10
|
+
if (bytes < 1024) return `${bytes} bytes`;
|
|
11
|
+
if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
12
|
+
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when the Wasm module fails to initialize
|
|
16
|
+
*/
|
|
17
|
+
var TagLibInitializationError = class TagLibInitializationError extends TagLibError {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new TagLibInitializationError
|
|
20
|
+
* @param message - Description of the initialization failure
|
|
21
|
+
* @param details - Additional context about the error
|
|
22
|
+
*/
|
|
23
|
+
constructor(message, details) {
|
|
24
|
+
super("INITIALIZATION", createErrorMessage("Failed to initialize TagLib Wasm module", message), details);
|
|
25
|
+
this.name = "TagLibInitializationError";
|
|
26
|
+
Object.setPrototypeOf(this, TagLibInitializationError.prototype);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown when an audio file format is invalid or corrupted
|
|
31
|
+
*/
|
|
32
|
+
var InvalidFormatError = class InvalidFormatError extends TagLibError {
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new InvalidFormatError
|
|
35
|
+
* @param message - Description of the format error
|
|
36
|
+
* @param bufferSize - Size of the audio buffer in bytes
|
|
37
|
+
* @param details - Additional context about the error
|
|
38
|
+
*/
|
|
39
|
+
constructor(message, bufferSize, details) {
|
|
40
|
+
const errorDetails = [`Invalid audio file format: ${message}`];
|
|
41
|
+
if (bufferSize !== void 0) {
|
|
42
|
+
errorDetails.push(`Buffer size: ${formatFileSize(bufferSize)}`);
|
|
43
|
+
if (bufferSize < 1024) errorDetails.push("Audio files must be at least 1KB to contain valid headers.");
|
|
44
|
+
}
|
|
45
|
+
super("INVALID_FORMAT", errorDetails.join(". "), {
|
|
46
|
+
...details,
|
|
47
|
+
bufferSize
|
|
48
|
+
});
|
|
49
|
+
this.bufferSize = bufferSize;
|
|
50
|
+
this.name = "InvalidFormatError";
|
|
51
|
+
Object.setPrototypeOf(this, InvalidFormatError.prototype);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Error thrown when an audio format is recognized but not supported
|
|
56
|
+
*/
|
|
57
|
+
var UnsupportedFormatError = class UnsupportedFormatError extends TagLibError {
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new UnsupportedFormatError
|
|
60
|
+
* @param format - The unsupported format that was encountered
|
|
61
|
+
* @param supportedFormats - List of formats that are supported
|
|
62
|
+
* @param details - Additional context about the error
|
|
63
|
+
*/
|
|
64
|
+
constructor(format, supportedFormats = SUPPORTED_FORMATS, details) {
|
|
65
|
+
super("UNSUPPORTED_FORMAT", `Unsupported audio format: ${format}. Supported formats: ${supportedFormats.join(", ")}`, {
|
|
66
|
+
...details,
|
|
67
|
+
format,
|
|
68
|
+
supportedFormats
|
|
69
|
+
});
|
|
70
|
+
this.format = format;
|
|
71
|
+
this.supportedFormats = supportedFormats;
|
|
72
|
+
this.name = "UnsupportedFormatError";
|
|
73
|
+
Object.setPrototypeOf(this, UnsupportedFormatError.prototype);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Error thrown during file operations (read, write, save)
|
|
78
|
+
*/
|
|
79
|
+
var FileOperationError = class FileOperationError extends TagLibError {
|
|
80
|
+
/**
|
|
81
|
+
* Creates a new FileOperationError
|
|
82
|
+
* @param operation - The file operation that failed
|
|
83
|
+
* @param message - Description of the failure
|
|
84
|
+
* @param path - File path involved in the operation
|
|
85
|
+
* @param details - Additional context about the error
|
|
86
|
+
*/
|
|
87
|
+
constructor(operation, message, path, details) {
|
|
88
|
+
const errorDetails = [`Failed to ${operation} file`];
|
|
89
|
+
if (path) errorDetails.push(`Path: ${path}`);
|
|
90
|
+
errorDetails.push(message);
|
|
91
|
+
super("FILE_OPERATION", errorDetails.join(". "), {
|
|
92
|
+
...details,
|
|
93
|
+
operation,
|
|
94
|
+
path
|
|
95
|
+
});
|
|
96
|
+
this.operation = operation;
|
|
97
|
+
this.path = path;
|
|
98
|
+
this.name = "FileOperationError";
|
|
99
|
+
Object.setPrototypeOf(this, FileOperationError.prototype);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Error thrown when metadata operations fail
|
|
104
|
+
*/
|
|
105
|
+
var MetadataError = class MetadataError extends TagLibError {
|
|
106
|
+
/**
|
|
107
|
+
* Creates a new MetadataError
|
|
108
|
+
* @param operation - The metadata operation that failed
|
|
109
|
+
* @param message - Description of the failure
|
|
110
|
+
* @param field - The metadata field involved
|
|
111
|
+
* @param details - Additional context about the error
|
|
112
|
+
*/
|
|
113
|
+
constructor(operation, message, field, details) {
|
|
114
|
+
const errorDetails = [`Failed to ${operation} metadata`];
|
|
115
|
+
if (field) errorDetails.push(`Field: ${field}`);
|
|
116
|
+
errorDetails.push(message);
|
|
117
|
+
super("METADATA", errorDetails.join(". "), {
|
|
118
|
+
...details,
|
|
119
|
+
operation,
|
|
120
|
+
field
|
|
121
|
+
});
|
|
122
|
+
this.operation = operation;
|
|
123
|
+
this.field = field;
|
|
124
|
+
this.name = "MetadataError";
|
|
125
|
+
Object.setPrototypeOf(this, MetadataError.prototype);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Error thrown when Wasm memory operations fail
|
|
130
|
+
*/
|
|
131
|
+
var MemoryError = class MemoryError extends TagLibError {
|
|
132
|
+
/**
|
|
133
|
+
* Creates a new MemoryError
|
|
134
|
+
* @param message - Description of the memory failure
|
|
135
|
+
* @param details - Additional context about the error
|
|
136
|
+
*/
|
|
137
|
+
constructor(message, details) {
|
|
138
|
+
super("MEMORY", createErrorMessage("Memory allocation failed", message), details);
|
|
139
|
+
this.name = "MemoryError";
|
|
140
|
+
Object.setPrototypeOf(this, MemoryError.prototype);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Error thrown when the environment doesn't support required features
|
|
145
|
+
*/
|
|
146
|
+
var EnvironmentError = class EnvironmentError extends TagLibError {
|
|
147
|
+
/**
|
|
148
|
+
* Creates a new EnvironmentError
|
|
149
|
+
* @param environment - The runtime environment name
|
|
150
|
+
* @param reason - Why the environment is incompatible
|
|
151
|
+
* @param requiredFeature - The feature that is missing
|
|
152
|
+
*/
|
|
153
|
+
constructor(environment, reason, requiredFeature) {
|
|
154
|
+
const message = requiredFeature ? `Environment '${environment}' ${reason}. Required feature: ${requiredFeature}.` : `Environment '${environment}' ${reason}.`;
|
|
155
|
+
super("ENVIRONMENT", message);
|
|
156
|
+
this.environment = environment;
|
|
157
|
+
this.reason = reason;
|
|
158
|
+
this.requiredFeature = requiredFeature;
|
|
159
|
+
this.name = "EnvironmentError";
|
|
160
|
+
Object.setPrototypeOf(this, EnvironmentError.prototype);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
//#endregion
|
|
164
|
+
export { EnvironmentError, FileOperationError, InvalidFormatError, MemoryError, MetadataError, TagLibInitializationError, UnsupportedFormatError, errorMessage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/errors/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,sBAAsB,EACvB,MAAM,cAAc,CAAC;AAEtB,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,kBAAkB,CAE7B;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,sBAAsB,CAEjC;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,kBAAkB,CAE7B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TagLibError } from "./base.js";
|
|
2
|
+
import { EnvironmentError, FileOperationError, InvalidFormatError, MemoryError, MetadataError, UnsupportedFormatError } from "./classes.js";
|
|
3
|
+
//#region src/errors/guards.ts
|
|
4
|
+
function isTagLibError(error) {
|
|
5
|
+
return error instanceof TagLibError;
|
|
6
|
+
}
|
|
7
|
+
function isInvalidFormatError(error) {
|
|
8
|
+
return error instanceof InvalidFormatError;
|
|
9
|
+
}
|
|
10
|
+
function isUnsupportedFormatError(error) {
|
|
11
|
+
return error instanceof UnsupportedFormatError;
|
|
12
|
+
}
|
|
13
|
+
function isFileOperationError(error) {
|
|
14
|
+
return error instanceof FileOperationError;
|
|
15
|
+
}
|
|
16
|
+
function isMetadataError(error) {
|
|
17
|
+
return error instanceof MetadataError;
|
|
18
|
+
}
|
|
19
|
+
function isMemoryError(error) {
|
|
20
|
+
return error instanceof MemoryError;
|
|
21
|
+
}
|
|
22
|
+
function isEnvironmentError(error) {
|
|
23
|
+
return error instanceof EnvironmentError;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isTagLibError, isUnsupportedFormatError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,aAAa,EACb,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SUPPORTED_FORMATS, TagLibError } from "./base.js";
|
|
2
|
+
import { EnvironmentError, FileOperationError, InvalidFormatError, MemoryError, MetadataError, TagLibInitializationError, UnsupportedFormatError, errorMessage } from "./classes.js";
|
|
3
|
+
import { isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isTagLibError, isUnsupportedFormatError } from "./guards.js";
|
|
4
|
+
export { EnvironmentError, FileOperationError, InvalidFormatError, MemoryError, MetadataError, SUPPORTED_FORMATS, TagLibError, TagLibInitializationError, UnsupportedFormatError, errorMessage, isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isTagLibError, isUnsupportedFormatError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,mBAAmB,CAAC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SUPPORTED_FORMATS, TagLibError } from "./errors/base.js";
|
|
2
|
+
import { EnvironmentError, FileOperationError, InvalidFormatError, MemoryError, MetadataError, TagLibInitializationError, UnsupportedFormatError, errorMessage } from "./errors/classes.js";
|
|
3
|
+
import { isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isTagLibError, isUnsupportedFormatError } from "./errors/guards.js";
|
|
4
|
+
import "./errors/index.js";
|
|
5
|
+
export { EnvironmentError, FileOperationError, InvalidFormatError, MemoryError, MetadataError, SUPPORTED_FORMATS, TagLibError, TagLibInitializationError, UnsupportedFormatError, errorMessage, isEnvironmentError, isFileOperationError, isInvalidFormatError, isMemoryError, isMetadataError, isTagLibError, isUnsupportedFormatError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-and-find.d.ts","sourceRoot":"","sources":["../../src/file-utils/copy-and-find.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;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,CA4Bf;AA2BD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAClE,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,CA6BD"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { MetadataError } from "../errors/classes.js";
|
|
2
|
+
import { writeFileData } from "../utils/write.js";
|
|
3
|
+
import { readFileData } from "../utils/file.js";
|
|
4
|
+
import { applyCoverArt, applyPictures, readCoverArt, readPictures } from "../simple/picture-operations.js";
|
|
5
|
+
import "../simple/index.js";
|
|
6
|
+
//#region src/file-utils/copy-and-find.ts
|
|
7
|
+
/**
|
|
8
|
+
* Copy cover art from one audio file to another
|
|
9
|
+
*
|
|
10
|
+
* @param sourcePath - Path to source audio file
|
|
11
|
+
* @param targetPath - Path to target audio file (modified in place)
|
|
12
|
+
* @param options - Copy options
|
|
13
|
+
* @returns Promise that resolves when cover art is copied
|
|
14
|
+
* @throws Error if source has no cover art
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Copy cover art from one file to another
|
|
19
|
+
* await copyCoverArt("album/track01.mp3", "album/track02.mp3");
|
|
20
|
+
*
|
|
21
|
+
* // Copy all pictures
|
|
22
|
+
* await copyCoverArt("source.mp3", "target.mp3", { copyAll: true });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async function copyCoverArt(sourcePath, targetPath, options = {}) {
|
|
26
|
+
if (options.copyAll) {
|
|
27
|
+
const pictures = await readPictures(sourcePath);
|
|
28
|
+
if (pictures.length === 0) throw new MetadataError("read", `No pictures found. Path: ${sourcePath}`);
|
|
29
|
+
const modifiedBuffer = await applyPictures(targetPath, pictures);
|
|
30
|
+
await writeFileData(targetPath, modifiedBuffer);
|
|
31
|
+
} else {
|
|
32
|
+
const coverData = await readCoverArt(sourcePath);
|
|
33
|
+
if (!coverData) throw new MetadataError("read", `No cover art found. Path: ${sourcePath}`);
|
|
34
|
+
const pictures = await readPictures(sourcePath);
|
|
35
|
+
const coverPicture = pictures.find((p) => p.type === "FrontCover") ?? pictures[0];
|
|
36
|
+
const modifiedBuffer = await applyCoverArt(targetPath, coverData, coverPicture.mimeType);
|
|
37
|
+
await writeFileData(targetPath, modifiedBuffer);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function fileExists(path) {
|
|
41
|
+
try {
|
|
42
|
+
return (await readFileData(path)).length > 0;
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function findCoverFile(dir, names, extensions) {
|
|
48
|
+
for (const name of names) for (const ext of extensions) {
|
|
49
|
+
const path = `${dir}${name}.${ext}`;
|
|
50
|
+
if (await fileExists(path)) return path;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Check if cover art files exist for an audio file
|
|
55
|
+
*
|
|
56
|
+
* Looks for common cover art filenames in the same directory as the audio file.
|
|
57
|
+
*
|
|
58
|
+
* @param audioPath - Path to the audio file
|
|
59
|
+
* @returns Object with found cover art paths
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const covers = await findCoverArtFiles("music/album/track01.mp3");
|
|
64
|
+
* if (covers.front) {
|
|
65
|
+
* await importCoverArt("music/album/track01.mp3", covers.front);
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
async function findCoverArtFiles(audioPath) {
|
|
70
|
+
const dir = audioPath.substring(0, audioPath.lastIndexOf("/") + 1);
|
|
71
|
+
const extensions = [
|
|
72
|
+
"jpg",
|
|
73
|
+
"jpeg",
|
|
74
|
+
"png",
|
|
75
|
+
"gif",
|
|
76
|
+
"webp"
|
|
77
|
+
];
|
|
78
|
+
const found = {};
|
|
79
|
+
const frontPath = await findCoverFile(dir, [
|
|
80
|
+
"cover",
|
|
81
|
+
"front",
|
|
82
|
+
"Cover",
|
|
83
|
+
"Front"
|
|
84
|
+
], extensions);
|
|
85
|
+
if (frontPath) found.front = frontPath;
|
|
86
|
+
const folderPath = await findCoverFile(dir, ["folder", "Folder"], extensions);
|
|
87
|
+
if (folderPath) found.folder = folderPath;
|
|
88
|
+
for (const name of [
|
|
89
|
+
"album",
|
|
90
|
+
"artwork",
|
|
91
|
+
"Album",
|
|
92
|
+
"Artwork"
|
|
93
|
+
]) {
|
|
94
|
+
const path = await findCoverFile(dir, [name], extensions);
|
|
95
|
+
if (path) found[name.toLowerCase()] = path;
|
|
96
|
+
}
|
|
97
|
+
const backPath = await findCoverFile(dir, [
|
|
98
|
+
"back",
|
|
99
|
+
"Back",
|
|
100
|
+
"back-cover",
|
|
101
|
+
"Back-Cover"
|
|
102
|
+
], extensions);
|
|
103
|
+
if (backPath) found.back = backPath;
|
|
104
|
+
return found;
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
export { copyCoverArt, findCoverArtFiles };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-operations.d.ts","sourceRoot":"","sources":["../../src/file-utils/export-operations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAMxD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IACP,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACrD,GACL,OAAO,CAAC,MAAM,EAAE,CAAC,CAgBnB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { MetadataError } from "../errors/classes.js";
|
|
2
|
+
import { writeFileData } from "../utils/write.js";
|
|
3
|
+
import { joinPath } from "../utils/path.js";
|
|
4
|
+
import { readCoverArt, readPictures } from "../simple/picture-operations.js";
|
|
5
|
+
import "../simple/index.js";
|
|
6
|
+
import { generatePictureFilename } from "./mime-detection.js";
|
|
7
|
+
//#region src/file-utils/export-operations.ts
|
|
8
|
+
/**
|
|
9
|
+
* Export cover art from an audio file to an image file
|
|
10
|
+
*
|
|
11
|
+
* Extracts the primary cover art (front cover if available, otherwise first picture)
|
|
12
|
+
* and saves it to the specified path.
|
|
13
|
+
*
|
|
14
|
+
* @param audioPath - Path to the audio file
|
|
15
|
+
* @param imagePath - Path where the image should be saved
|
|
16
|
+
* @returns Promise that resolves when the image is saved
|
|
17
|
+
* @throws Error if no cover art is found
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Export cover art as JPEG
|
|
22
|
+
* await exportCoverArt("album/track01.mp3", "album/cover.jpg");
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async function exportCoverArt(audioPath, imagePath) {
|
|
26
|
+
const coverData = await readCoverArt(audioPath);
|
|
27
|
+
if (!coverData) throw new MetadataError("read", `No cover art found. Path: ${audioPath}`);
|
|
28
|
+
await writeFileData(imagePath, coverData);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Export a specific picture type from an audio file
|
|
32
|
+
*
|
|
33
|
+
* @param audioPath - Path to the audio file
|
|
34
|
+
* @param imagePath - Path where the image should be saved
|
|
35
|
+
* @param type - Picture type to export
|
|
36
|
+
* @returns Promise that resolves when the image is saved
|
|
37
|
+
* @throws Error if no picture of the specified type is found
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* // Export back cover
|
|
42
|
+
* await exportPictureByType(
|
|
43
|
+
* "album/track01.mp3",
|
|
44
|
+
* "album/back-cover.jpg",
|
|
45
|
+
* PictureType.BackCover
|
|
46
|
+
* );
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
async function exportPictureByType(audioPath, imagePath, type) {
|
|
50
|
+
const picture = (await readPictures(audioPath)).find((pic) => pic.type === type);
|
|
51
|
+
if (!picture) throw new MetadataError("read", `No picture of type ${type} found. Path: ${audioPath}`);
|
|
52
|
+
await writeFileData(imagePath, picture.data);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Export all pictures from an audio file
|
|
56
|
+
*
|
|
57
|
+
* Saves each picture with a numbered suffix based on its type and index.
|
|
58
|
+
*
|
|
59
|
+
* @param audioPath - Path to the audio file
|
|
60
|
+
* @param outputDir - Directory where images should be saved
|
|
61
|
+
* @param options - Export options
|
|
62
|
+
* @returns Promise resolving to array of created file paths
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* // Export all pictures to a directory
|
|
67
|
+
* const files = await exportAllPictures("song.mp3", "./artwork/");
|
|
68
|
+
* console.log(`Exported ${files.length} pictures`);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
async function exportAllPictures(audioPath, outputDir, options = {}) {
|
|
72
|
+
const pictures = await readPictures(audioPath);
|
|
73
|
+
const exportedPaths = [];
|
|
74
|
+
for (let i = 0; i < pictures.length; i++) {
|
|
75
|
+
const picture = pictures[i];
|
|
76
|
+
const filename = options.nameFormat ? options.nameFormat(picture, i) : generatePictureFilename(picture, i);
|
|
77
|
+
const fullPath = joinPath(outputDir, filename);
|
|
78
|
+
await writeFileData(fullPath, picture.data);
|
|
79
|
+
exportedPaths.push(fullPath);
|
|
80
|
+
}
|
|
81
|
+
return exportedPaths;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { exportAllPictures, exportCoverArt, exportPictureByType };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-operations.d.ts","sourceRoot":"","sources":["../../src/file-utils/import-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAOxD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,GACL,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,GACL,OAAO,CAAC,IAAI,CAAC,CAef;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,WAA0B,EAChC,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,GACL,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { writeFileData } from "../utils/write.js";
|
|
2
|
+
import { readFileData } from "../utils/file.js";
|
|
3
|
+
import { basename } from "../utils/path.js";
|
|
4
|
+
import { applyCoverArt, replacePictureByType } from "../simple/picture-operations.js";
|
|
5
|
+
import "../simple/index.js";
|
|
6
|
+
import { detectMimeType } from "./mime-detection.js";
|
|
7
|
+
//#region src/file-utils/import-operations.ts
|
|
8
|
+
/**
|
|
9
|
+
* Import cover art from an image file to an audio file
|
|
10
|
+
*
|
|
11
|
+
* Replaces all existing pictures with a single front cover from the image file.
|
|
12
|
+
* The audio file is modified in place.
|
|
13
|
+
*
|
|
14
|
+
* @param audioPath - Path to the audio file to update
|
|
15
|
+
* @param imagePath - Path to the image file to import
|
|
16
|
+
* @param options - Import options
|
|
17
|
+
* @returns Promise that resolves when the audio file is updated
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Replace cover art with a new image
|
|
22
|
+
* await importCoverArt("song.mp3", "new-cover.jpg");
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
async function importCoverArt(audioPath, imagePath, options = {}) {
|
|
26
|
+
const imageData = await readFileData(imagePath);
|
|
27
|
+
const mimeType = detectMimeType(imagePath, options.mimeType);
|
|
28
|
+
const modifiedBuffer = await applyCoverArt(audioPath, imageData, mimeType);
|
|
29
|
+
await writeFileData(audioPath, modifiedBuffer);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Import a picture from file with specific type
|
|
33
|
+
*
|
|
34
|
+
* Adds or replaces a picture of the specified type in the audio file.
|
|
35
|
+
* The audio file is modified in place.
|
|
36
|
+
*
|
|
37
|
+
* @param audioPath - Path to the audio file to update
|
|
38
|
+
* @param imagePath - Path to the image file to import
|
|
39
|
+
* @param type - Picture type to set
|
|
40
|
+
* @param options - Import options
|
|
41
|
+
* @returns Promise that resolves when the audio file is updated
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Add a back cover
|
|
46
|
+
* await importPictureWithType(
|
|
47
|
+
* "song.mp3",
|
|
48
|
+
* "back-cover.jpg",
|
|
49
|
+
* PictureType.BackCover,
|
|
50
|
+
* { description: "Album back cover" }
|
|
51
|
+
* );
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
async function importPictureWithType(audioPath, imagePath, type, options = {}) {
|
|
55
|
+
const imageData = await readFileData(imagePath);
|
|
56
|
+
const picture = {
|
|
57
|
+
mimeType: detectMimeType(imagePath, options.mimeType),
|
|
58
|
+
data: imageData,
|
|
59
|
+
type,
|
|
60
|
+
...options.description !== void 0 ? { description: options.description } : {}
|
|
61
|
+
};
|
|
62
|
+
const modifiedBuffer = await replacePictureByType(audioPath, picture);
|
|
63
|
+
await writeFileData(audioPath, modifiedBuffer);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Load a picture from an image file
|
|
67
|
+
*
|
|
68
|
+
* @param imagePath - Path to the image file
|
|
69
|
+
* @param type - Picture type (defaults to FrontCover)
|
|
70
|
+
* @param options - Picture options
|
|
71
|
+
* @returns Picture object ready to be applied to audio files
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const frontCover = await loadPictureFromFile("cover.jpg");
|
|
76
|
+
* const backCover = await loadPictureFromFile("back.png", PictureType.BackCover);
|
|
77
|
+
*
|
|
78
|
+
* const modifiedBuffer = await applyPictures("song.mp3", [frontCover, backCover]);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
async function loadPictureFromFile(imagePath, type = "FrontCover", options = {}) {
|
|
82
|
+
const data = await readFileData(imagePath);
|
|
83
|
+
return {
|
|
84
|
+
mimeType: detectMimeType(imagePath, options.mimeType),
|
|
85
|
+
data,
|
|
86
|
+
type,
|
|
87
|
+
description: options.description ?? basename(imagePath)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Save a picture to an image file
|
|
92
|
+
*
|
|
93
|
+
* @param picture - Picture object to save
|
|
94
|
+
* @param imagePath - Path where the image should be saved
|
|
95
|
+
* @returns Promise that resolves when the image is saved
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const pictures = await readPictures("song.mp3");
|
|
100
|
+
* for (const picture of pictures) {
|
|
101
|
+
* await savePictureToFile(picture, `export-${picture.type}.jpg`);
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
async function savePictureToFile(picture, imagePath) {
|
|
106
|
+
await writeFileData(imagePath, picture.data);
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { detectMimeType, generatePictureFilename } from "./mime-detection.js";
|
|
2
|
+
import { exportAllPictures, exportCoverArt, exportPictureByType } from "./export-operations.js";
|
|
3
|
+
import { importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile } from "./import-operations.js";
|
|
4
|
+
import { copyCoverArt, findCoverArtFiles } from "./copy-and-find.js";
|
|
5
|
+
export { copyCoverArt, detectMimeType, exportAllPictures, exportCoverArt, exportPictureByType, findCoverArtFiles, generatePictureFilename, importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime-detection.d.ts","sourceRoot":"","sources":["../../src/file-utils/mime-detection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AAWxD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAItE;AA0BD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR"}
|