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
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { isNamedAudioInput } from "../types/audio-formats.js";
|
|
2
|
-
import { InvalidFormatError } from "../errors.js";
|
|
3
|
-
import { fromTagLibKey } from "../constants/properties.js";
|
|
4
|
-
import { mergeTagUpdatesInto, readExtendedTag } from "../utils/tag-mapping.js";
|
|
5
|
-
import { withAudioFileSaveToFile } from "./with-audio-file.js";
|
|
6
|
-
import { getTagLib } from "./config.js";
|
|
7
|
-
async function executeBatch(files, options, processor) {
|
|
8
|
-
if (files.length === 0) return { items: [], duration: 0 };
|
|
9
|
-
const startTime = Date.now();
|
|
10
|
-
const { concurrency = 4, continueOnError = true, onProgress, signal } = options;
|
|
11
|
-
const items = new Array(files.length);
|
|
12
|
-
const taglib = await getTagLib();
|
|
13
|
-
let processed = 0;
|
|
14
|
-
const total = files.length;
|
|
15
|
-
for (let i = 0; i < files.length; i += concurrency) {
|
|
16
|
-
signal?.throwIfAborted();
|
|
17
|
-
const chunk = files.slice(i, i + concurrency);
|
|
18
|
-
const chunkPromises = chunk.map(async (file, idx) => {
|
|
19
|
-
const index = i + idx;
|
|
20
|
-
const fileName = typeof file === "string" ? file : file instanceof File ? file.name : isNamedAudioInput(file) ? file.name : `buffer-${index}`;
|
|
21
|
-
try {
|
|
22
|
-
const audioFile = await taglib.open(file);
|
|
23
|
-
try {
|
|
24
|
-
if (!audioFile.isValid()) {
|
|
25
|
-
throw new InvalidFormatError(
|
|
26
|
-
"File may be corrupted or in an unsupported format"
|
|
27
|
-
);
|
|
28
|
-
}
|
|
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] = { status: "error", path: fileName, error: err };
|
|
40
|
-
if (!continueOnError) throw err;
|
|
41
|
-
}
|
|
42
|
-
processed++;
|
|
43
|
-
onProgress?.(processed, total, fileName);
|
|
44
|
-
});
|
|
45
|
-
await Promise.all(chunkPromises);
|
|
46
|
-
}
|
|
47
|
-
return { items, duration: Date.now() - startTime };
|
|
48
|
-
}
|
|
49
|
-
async function readTagsBatch(files, options = {}) {
|
|
50
|
-
return executeBatch(
|
|
51
|
-
files,
|
|
52
|
-
options,
|
|
53
|
-
(audioFile) => readExtendedTag(audioFile, options.includeProperties)
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
async function readPropertiesBatch(files, options = {}) {
|
|
57
|
-
return executeBatch(
|
|
58
|
-
files,
|
|
59
|
-
options,
|
|
60
|
-
(audioFile) => audioFile.audioProperties()
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
function extractDynamics(audioFile) {
|
|
64
|
-
const dynamics = {};
|
|
65
|
-
const fields = [
|
|
66
|
-
"replayGainTrackGain",
|
|
67
|
-
"replayGainTrackPeak",
|
|
68
|
-
"replayGainAlbumGain",
|
|
69
|
-
"replayGainAlbumPeak"
|
|
70
|
-
];
|
|
71
|
-
for (const field of fields) {
|
|
72
|
-
const val = audioFile.getProperty(field)?.[0];
|
|
73
|
-
if (val !== void 0) dynamics[field] = val;
|
|
74
|
-
}
|
|
75
|
-
let appleSoundCheck = audioFile.getProperty("appleSoundCheck")?.[0];
|
|
76
|
-
if (!appleSoundCheck && audioFile.isMP4()) {
|
|
77
|
-
appleSoundCheck = audioFile.getMP4Item("----:com.apple.iTunes:iTunNORM");
|
|
78
|
-
}
|
|
79
|
-
if (appleSoundCheck) dynamics.appleSoundCheck = appleSoundCheck;
|
|
80
|
-
return Object.keys(dynamics).length > 0 ? dynamics : void 0;
|
|
81
|
-
}
|
|
82
|
-
async function readMetadata(file, options = {}) {
|
|
83
|
-
const taglib = await getTagLib();
|
|
84
|
-
const audioFile = await taglib.open(file);
|
|
85
|
-
try {
|
|
86
|
-
if (!audioFile.isValid()) {
|
|
87
|
-
let name;
|
|
88
|
-
if (typeof file === "string") {
|
|
89
|
-
name = file;
|
|
90
|
-
} else if (file instanceof File) {
|
|
91
|
-
name = file.name;
|
|
92
|
-
} else if (isNamedAudioInput(file)) {
|
|
93
|
-
name = file.name;
|
|
94
|
-
} else {
|
|
95
|
-
name = `buffer (${file.byteLength} bytes)`;
|
|
96
|
-
}
|
|
97
|
-
throw new InvalidFormatError(
|
|
98
|
-
`File may be corrupted or in an unsupported format. File: ${name}`
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
const dynamics = extractDynamics(audioFile);
|
|
102
|
-
return {
|
|
103
|
-
tags: readExtendedTag(audioFile, options.includeProperties),
|
|
104
|
-
properties: audioFile.audioProperties(),
|
|
105
|
-
hasCoverArt: audioFile.getPictures().length > 0,
|
|
106
|
-
...dynamics !== void 0 ? { dynamics } : {}
|
|
107
|
-
};
|
|
108
|
-
} finally {
|
|
109
|
-
audioFile.dispose();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
async function readMetadataBatch(files, options = {}) {
|
|
113
|
-
return executeBatch(files, options, (audioFile) => {
|
|
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
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function entryPath(entry) {
|
|
124
|
-
return typeof entry === "string" ? entry : entry.path;
|
|
125
|
-
}
|
|
126
|
-
async function executeWriteBatch(entries, options, writer) {
|
|
127
|
-
if (entries.length === 0) return { items: [], duration: 0 };
|
|
128
|
-
await getTagLib();
|
|
129
|
-
const startTime = Date.now();
|
|
130
|
-
const { concurrency = 4, continueOnError = true, onProgress, signal } = options;
|
|
131
|
-
const items = new Array(entries.length);
|
|
132
|
-
let processed = 0;
|
|
133
|
-
const total = entries.length;
|
|
134
|
-
for (let i = 0; i < entries.length; i += concurrency) {
|
|
135
|
-
signal?.throwIfAborted();
|
|
136
|
-
const chunk = entries.slice(i, i + concurrency);
|
|
137
|
-
const chunkPromises = chunk.map(async (entry, idx) => {
|
|
138
|
-
const index = i + idx;
|
|
139
|
-
const path = entryPath(entry);
|
|
140
|
-
try {
|
|
141
|
-
await writer(path);
|
|
142
|
-
items[index] = { status: "ok", path, data: void 0 };
|
|
143
|
-
} catch (error) {
|
|
144
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
145
|
-
items[index] = { status: "error", path, error: err };
|
|
146
|
-
if (!continueOnError) throw err;
|
|
147
|
-
}
|
|
148
|
-
processed++;
|
|
149
|
-
onProgress?.(processed, total, path);
|
|
150
|
-
});
|
|
151
|
-
await Promise.all(chunkPromises);
|
|
152
|
-
}
|
|
153
|
-
return { items, duration: Date.now() - startTime };
|
|
154
|
-
}
|
|
155
|
-
async function writeTagsBatch(updates, options = {}) {
|
|
156
|
-
const byPath = new Map(updates.map((u) => [u.path, u]));
|
|
157
|
-
return executeWriteBatch(
|
|
158
|
-
updates,
|
|
159
|
-
options,
|
|
160
|
-
(path) => withAudioFileSaveToFile(path, (audioFile) => {
|
|
161
|
-
const update = byPath.get(path);
|
|
162
|
-
const merged = update.tags !== void 0 ? mergeTagUpdatesInto(audioFile.properties(), update.tags) : audioFile.properties();
|
|
163
|
-
if (update.properties !== void 0) {
|
|
164
|
-
for (const [key, values] of Object.entries(update.properties)) {
|
|
165
|
-
merged[fromTagLibKey(key)] = values;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
audioFile.setProperties(merged);
|
|
169
|
-
})
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
async function editTagsBatch(files, mutator, options = {}) {
|
|
173
|
-
return executeWriteBatch(
|
|
174
|
-
files,
|
|
175
|
-
options,
|
|
176
|
-
(path) => withAudioFileSaveToFile(path, (audioFile) => mutator(audioFile, path))
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
export {
|
|
180
|
-
editTagsBatch,
|
|
181
|
-
readMetadata,
|
|
182
|
-
readMetadataBatch,
|
|
183
|
-
readPropertiesBatch,
|
|
184
|
-
readTagsBatch,
|
|
185
|
-
writeTagsBatch
|
|
186
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
let cachedTagLib = null;
|
|
2
|
-
let bufferModeEnabled = false;
|
|
3
|
-
function setBufferMode(enabled) {
|
|
4
|
-
bufferModeEnabled = enabled;
|
|
5
|
-
cachedTagLib = null;
|
|
6
|
-
}
|
|
7
|
-
async function getTagLib() {
|
|
8
|
-
if (!cachedTagLib) {
|
|
9
|
-
const { TagLib } = await import("../taglib.js");
|
|
10
|
-
const initOptions = bufferModeEnabled ? { forceWasmType: "emscripten" } : void 0;
|
|
11
|
-
cachedTagLib = await TagLib.initialize(initOptions);
|
|
12
|
-
}
|
|
13
|
-
return cachedTagLib;
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
getTagLib,
|
|
17
|
-
setBufferMode
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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,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"}
|
package/dist/src/simple/index.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { getTagLib, setBufferMode } from "./config.js";
|
|
2
|
-
import {
|
|
3
|
-
applyTags,
|
|
4
|
-
applyTagsToFile,
|
|
5
|
-
clearTags,
|
|
6
|
-
isValidAudioFile,
|
|
7
|
-
readFormat,
|
|
8
|
-
readProperties,
|
|
9
|
-
readTags
|
|
10
|
-
} from "./tag-operations.js";
|
|
11
|
-
import {
|
|
12
|
-
addPicture,
|
|
13
|
-
applyCoverArt,
|
|
14
|
-
applyPictures,
|
|
15
|
-
clearPictures,
|
|
16
|
-
findPictureByType,
|
|
17
|
-
readCoverArt,
|
|
18
|
-
readPictureMetadata,
|
|
19
|
-
readPictures,
|
|
20
|
-
replacePictureByType
|
|
21
|
-
} from "./picture-operations.js";
|
|
22
|
-
import {
|
|
23
|
-
editTagsBatch,
|
|
24
|
-
readMetadata,
|
|
25
|
-
readMetadataBatch,
|
|
26
|
-
readPropertiesBatch,
|
|
27
|
-
readTagsBatch,
|
|
28
|
-
writeTagsBatch
|
|
29
|
-
} from "./batch-operations.js";
|
|
30
|
-
import { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES } from "../types.js";
|
|
31
|
-
export {
|
|
32
|
-
PICTURE_TYPE_NAMES,
|
|
33
|
-
PICTURE_TYPE_VALUES,
|
|
34
|
-
addPicture,
|
|
35
|
-
applyCoverArt,
|
|
36
|
-
applyPictures,
|
|
37
|
-
applyTags,
|
|
38
|
-
applyTagsToFile,
|
|
39
|
-
clearPictures,
|
|
40
|
-
clearTags,
|
|
41
|
-
editTagsBatch,
|
|
42
|
-
findPictureByType,
|
|
43
|
-
getTagLib,
|
|
44
|
-
isValidAudioFile,
|
|
45
|
-
readCoverArt,
|
|
46
|
-
readFormat,
|
|
47
|
-
readMetadata,
|
|
48
|
-
readMetadataBatch,
|
|
49
|
-
readPictureMetadata,
|
|
50
|
-
readPictures,
|
|
51
|
-
readProperties,
|
|
52
|
-
readPropertiesBatch,
|
|
53
|
-
readTags,
|
|
54
|
-
readTagsBatch,
|
|
55
|
-
replacePictureByType,
|
|
56
|
-
setBufferMode,
|
|
57
|
-
writeTagsBatch
|
|
58
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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,CAChC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,OAAO,EAAE,CAAC,CAEpB;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,CACjC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,UAAU,CAAC,CAErB;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,CACvC,IAAI,EAAE,cAAc,GACnB,OAAO,CACR,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"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { withAudioFile, withAudioFileSave } from "./with-audio-file.js";
|
|
2
|
-
async function readPictures(file) {
|
|
3
|
-
return withAudioFile(file, (audioFile) => audioFile.getPictures());
|
|
4
|
-
}
|
|
5
|
-
async function applyPictures(file, pictures) {
|
|
6
|
-
return withAudioFileSave(file, (audioFile) => {
|
|
7
|
-
audioFile.setPictures(pictures);
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
async function addPicture(file, picture) {
|
|
11
|
-
return withAudioFileSave(file, (audioFile) => {
|
|
12
|
-
audioFile.addPicture(picture);
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
async function clearPictures(file) {
|
|
16
|
-
return applyPictures(file, []);
|
|
17
|
-
}
|
|
18
|
-
async function readCoverArt(file) {
|
|
19
|
-
const pictures = await readPictures(file);
|
|
20
|
-
if (pictures.length === 0) {
|
|
21
|
-
return void 0;
|
|
22
|
-
}
|
|
23
|
-
const frontCover = pictures.find((pic) => pic.type === "FrontCover");
|
|
24
|
-
if (frontCover) {
|
|
25
|
-
return frontCover.data;
|
|
26
|
-
}
|
|
27
|
-
return pictures[0].data;
|
|
28
|
-
}
|
|
29
|
-
async function applyCoverArt(file, imageData, mimeType) {
|
|
30
|
-
const picture = {
|
|
31
|
-
mimeType,
|
|
32
|
-
data: imageData,
|
|
33
|
-
type: "FrontCover",
|
|
34
|
-
description: "Front Cover"
|
|
35
|
-
};
|
|
36
|
-
return applyPictures(file, [picture]);
|
|
37
|
-
}
|
|
38
|
-
function findPictureByType(pictures, type) {
|
|
39
|
-
return pictures.find((pic) => pic.type === type);
|
|
40
|
-
}
|
|
41
|
-
async function replacePictureByType(file, newPicture) {
|
|
42
|
-
const pictures = await readPictures(file);
|
|
43
|
-
const filteredPictures = pictures.filter(
|
|
44
|
-
(pic) => pic.type !== newPicture.type
|
|
45
|
-
);
|
|
46
|
-
filteredPictures.push(newPicture);
|
|
47
|
-
return applyPictures(file, filteredPictures);
|
|
48
|
-
}
|
|
49
|
-
async function readPictureMetadata(file) {
|
|
50
|
-
const pictures = await readPictures(file);
|
|
51
|
-
return pictures.map((pic) => ({
|
|
52
|
-
type: pic.type,
|
|
53
|
-
mimeType: pic.mimeType,
|
|
54
|
-
...pic.description !== void 0 ? { description: pic.description } : {},
|
|
55
|
-
size: pic.data.length
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
addPicture,
|
|
60
|
-
applyCoverArt,
|
|
61
|
-
applyPictures,
|
|
62
|
-
clearPictures,
|
|
63
|
-
findPictureByType,
|
|
64
|
-
readCoverArt,
|
|
65
|
-
readPictureMetadata,
|
|
66
|
-
readPictures,
|
|
67
|
-
replacePictureByType
|
|
68
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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,CAKtB;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,CACpC,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,OAAO,CAAC,CAYlB;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAW/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,UAAU,CAAC,CAsBrB"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { FileOperationError, MetadataError } from "../errors.js";
|
|
2
|
-
import { mergeTagUpdates, readExtendedTag } from "../utils/tag-mapping.js";
|
|
3
|
-
import { getTagLib } from "./config.js";
|
|
4
|
-
import {
|
|
5
|
-
withAudioFile,
|
|
6
|
-
withAudioFileSave,
|
|
7
|
-
withAudioFileSaveToFile
|
|
8
|
-
} from "./with-audio-file.js";
|
|
9
|
-
async function readTags(file, options = {}) {
|
|
10
|
-
return withAudioFile(
|
|
11
|
-
file,
|
|
12
|
-
(audioFile) => readExtendedTag(audioFile, options.includeProperties)
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
async function applyTags(file, tags) {
|
|
16
|
-
return withAudioFileSave(file, (audioFile) => {
|
|
17
|
-
mergeTagUpdates(audioFile, tags);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async function applyTagsToFile(file, tags) {
|
|
21
|
-
if (typeof file !== "string") {
|
|
22
|
-
throw new FileOperationError(
|
|
23
|
-
"save",
|
|
24
|
-
"applyTagsToFile requires a file path string to save changes"
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
await withAudioFileSaveToFile(file, (audioFile) => {
|
|
28
|
-
mergeTagUpdates(audioFile, tags);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
async function readProperties(file) {
|
|
32
|
-
return withAudioFile(file, (audioFile) => {
|
|
33
|
-
const props = audioFile.audioProperties();
|
|
34
|
-
if (!props) {
|
|
35
|
-
throw new MetadataError(
|
|
36
|
-
"read",
|
|
37
|
-
"File may not contain valid audio data",
|
|
38
|
-
"audioProperties"
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
return props;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async function isValidAudioFile(file) {
|
|
45
|
-
try {
|
|
46
|
-
const taglib = await getTagLib();
|
|
47
|
-
const audioFile = await taglib.open(file);
|
|
48
|
-
try {
|
|
49
|
-
return audioFile.isValid();
|
|
50
|
-
} finally {
|
|
51
|
-
audioFile.dispose();
|
|
52
|
-
}
|
|
53
|
-
} catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async function readFormat(file) {
|
|
58
|
-
const taglib = await getTagLib();
|
|
59
|
-
const audioFile = await taglib.open(file);
|
|
60
|
-
try {
|
|
61
|
-
if (!audioFile.isValid()) {
|
|
62
|
-
return void 0;
|
|
63
|
-
}
|
|
64
|
-
return audioFile.getFormat();
|
|
65
|
-
} finally {
|
|
66
|
-
audioFile.dispose();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function clearTags(file) {
|
|
70
|
-
return withAudioFileSave(file, (audioFile) => {
|
|
71
|
-
const cleared = {};
|
|
72
|
-
for (const key of Object.keys(audioFile.properties())) cleared[key] = [];
|
|
73
|
-
audioFile.setProperties(cleared);
|
|
74
|
-
audioFile.removePictures();
|
|
75
|
-
audioFile.setLyrics([]);
|
|
76
|
-
audioFile.setRatings([]);
|
|
77
|
-
if (audioFile.getChapters().length > 0) audioFile.setChapters([]);
|
|
78
|
-
if (audioFile.getBextData() !== void 0) audioFile.setBextData(null);
|
|
79
|
-
if (audioFile.getIxml() !== void 0) audioFile.setIxml(null);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
export {
|
|
83
|
-
applyTags,
|
|
84
|
-
applyTagsToFile,
|
|
85
|
-
clearTags,
|
|
86
|
-
isValidAudioFile,
|
|
87
|
-
readFormat,
|
|
88
|
-
readProperties,
|
|
89
|
-
readTags
|
|
90
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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,CAWrB;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GACjC,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { FileOperationError, InvalidFormatError } from "../errors.js";
|
|
2
|
-
import { getTagLib } from "./config.js";
|
|
3
|
-
async function withAudioFile(file, fn, options) {
|
|
4
|
-
const taglib = await getTagLib();
|
|
5
|
-
const audioFile = await taglib.open(file, options);
|
|
6
|
-
try {
|
|
7
|
-
if (!audioFile.isValid()) {
|
|
8
|
-
throw new InvalidFormatError(
|
|
9
|
-
"File may be corrupted or in an unsupported format"
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
return await fn(audioFile);
|
|
13
|
-
} finally {
|
|
14
|
-
audioFile.dispose();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
async function withAudioFileSave(file, fn) {
|
|
18
|
-
return withAudioFile(file, (audioFile) => {
|
|
19
|
-
fn(audioFile);
|
|
20
|
-
if (!audioFile.save()) {
|
|
21
|
-
throw new FileOperationError(
|
|
22
|
-
"save",
|
|
23
|
-
"Failed to save metadata changes. The file may be read-only or corrupted."
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
return audioFile.getFileBuffer();
|
|
27
|
-
}, { partial: false });
|
|
28
|
-
}
|
|
29
|
-
async function withAudioFileSaveToFile(file, fn) {
|
|
30
|
-
return withAudioFile(file, async (audioFile) => {
|
|
31
|
-
fn(audioFile);
|
|
32
|
-
await audioFile.saveToFile(file);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
withAudioFile,
|
|
37
|
-
withAudioFileSave,
|
|
38
|
-
withAudioFileSaveToFile
|
|
39
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-file-base.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,WAAW,EACX,WAAW,EACZ,MAAM,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAiBhE;;;;;GAKG;AACH,8BAAsB,iBAAiB;IAgBnC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY;IAfzC,SAAS,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5C,SAAS,CAAC,qBAAqB,EAAE,eAAe,GAAG,IAAI,CAAQ;IAC/D,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,SAAS,CAAC,cAAc,EACpB,MAAM,GACN,UAAU,GACV,WAAW,GACX,IAAI,GACJ,SAAS,CAAC;IACd,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAS;IAC7C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/D,gFAAgF;IAChF,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;gBAGjD,MAAM,EAAE,YAAY,EACvC,UAAU,EAAE,cAAc,EAC1B,UAAU,CAAC,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,IAAI,EACzD,iBAAiB,GAAE,OAAe,EAClC,kBAAkB,CAAC,EAAE,WAAW;IAgBlC;;;;;;OAMG;IACH,SAAS,CAAC,0BAA0B,IAAI,WAAW,CAAC,MAAM,CAAC;IAU3D,SAAS,KAAK,MAAM,IAAI,cAAc,CAKrC;IAED,SAAS,IAAI,QAAQ;IAIrB,QAAQ,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,IAAI,cAAc,CAAC,CAAC,CAAC;IAIlE,GAAG,IAAI,UAAU;IAIjB,eAAe,IAAI,eAAe,GAAG,SAAS;IAO9C,UAAU,IAAI,WAAW;IAMzB,aAAa,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI;IA4B5C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IA4B9C,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAkD7C;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC,KAAK,IAAI,OAAO;IAIhB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAe3C,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAoB5C,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAOhC,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,IAAI;IASf,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGzB"}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
5
|
-
fromTagLibKey,
|
|
6
|
-
mp4AtomWireKey,
|
|
7
|
-
mp4FreeformAtomNames,
|
|
8
|
-
remapKeysFromTagLib,
|
|
9
|
-
toTagLibKey
|
|
10
|
-
} from "../constants/properties.js";
|
|
11
|
-
import { MetadataError, UnsupportedFormatError } from "../errors.js";
|
|
12
|
-
import { MP4_ITEM_NAMES_KEY } from "./mp4-item-names.js";
|
|
13
|
-
import { buildMutableTag } from "./mutable-tag-impl.js";
|
|
14
|
-
import { registerAutoDispose, unregisterAutoDispose } from "./auto-dispose.js";
|
|
15
|
-
const LYRICS_PROPERTY_KEY = "lyrics";
|
|
16
|
-
const LYRICS_WIRE_KEY = toTagLibKey(LYRICS_PROPERTY_KEY);
|
|
17
|
-
const EMPTY_KEY_SET = /* @__PURE__ */ new Set();
|
|
18
|
-
class BaseAudioFileImpl {
|
|
19
|
-
constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
|
|
20
|
-
__publicField(this, "module", module);
|
|
21
|
-
__publicField(this, "fileHandle");
|
|
22
|
-
__publicField(this, "cachedAudioProperties", null);
|
|
23
|
-
__publicField(this, "sourcePath");
|
|
24
|
-
__publicField(this, "originalSource");
|
|
25
|
-
__publicField(this, "isPartiallyLoaded", false);
|
|
26
|
-
__publicField(this, "partialLoadOptions");
|
|
27
|
-
/** Text-property wire keys in the partial header at load; undefined if full. */
|
|
28
|
-
__publicField(this, "partialKeysAtLoad");
|
|
29
|
-
this.fileHandle = fileHandle;
|
|
30
|
-
this.sourcePath = sourcePath;
|
|
31
|
-
this.originalSource = originalSource;
|
|
32
|
-
this.isPartiallyLoaded = isPartiallyLoaded;
|
|
33
|
-
this.partialLoadOptions = partialLoadOptions;
|
|
34
|
-
this.partialKeysAtLoad = isPartiallyLoaded ? new Set(Object.keys(fileHandle.getProperties())) : void 0;
|
|
35
|
-
registerAutoDispose(this, fileHandle);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Wire-key text properties present in the partial header at load but now
|
|
39
|
-
* absent — the user deleted them. The partial-load reconstruct subtracts these
|
|
40
|
-
* from its preserve-the-original merge so a deletion persists without wiping
|
|
41
|
-
* frames beyond the loaded header (taglib-d14). Lyrics are excluded (they ride
|
|
42
|
-
* their own reconstruct path); empty for a full load.
|
|
43
|
-
*/
|
|
44
|
-
partialDeletedPropertyKeys() {
|
|
45
|
-
if (!this.partialKeysAtLoad) return EMPTY_KEY_SET;
|
|
46
|
-
const current = new Set(Object.keys(this.handle.getProperties()));
|
|
47
|
-
const deleted = /* @__PURE__ */ new Set();
|
|
48
|
-
for (const key of this.partialKeysAtLoad) {
|
|
49
|
-
if (key !== LYRICS_WIRE_KEY && !current.has(key)) deleted.add(key);
|
|
50
|
-
}
|
|
51
|
-
return deleted;
|
|
52
|
-
}
|
|
53
|
-
get handle() {
|
|
54
|
-
if (!this.fileHandle) {
|
|
55
|
-
throw new MetadataError("read", "File handle has been disposed");
|
|
56
|
-
}
|
|
57
|
-
return this.fileHandle;
|
|
58
|
-
}
|
|
59
|
-
getFormat() {
|
|
60
|
-
return this.handle.getFormat();
|
|
61
|
-
}
|
|
62
|
-
isFormat(format) {
|
|
63
|
-
return this.getFormat() === format;
|
|
64
|
-
}
|
|
65
|
-
tag() {
|
|
66
|
-
return buildMutableTag(this.handle);
|
|
67
|
-
}
|
|
68
|
-
audioProperties() {
|
|
69
|
-
if (!this.cachedAudioProperties) {
|
|
70
|
-
this.cachedAudioProperties = this.handle.getAudioProperties() ?? null;
|
|
71
|
-
}
|
|
72
|
-
return this.cachedAudioProperties ?? void 0;
|
|
73
|
-
}
|
|
74
|
-
properties() {
|
|
75
|
-
const remapped = remapKeysFromTagLib(this.handle.getProperties());
|
|
76
|
-
delete remapped[LYRICS_PROPERTY_KEY];
|
|
77
|
-
return remapped;
|
|
78
|
-
}
|
|
79
|
-
setProperties(properties) {
|
|
80
|
-
const translated = {};
|
|
81
|
-
for (const [key, values] of Object.entries(properties)) {
|
|
82
|
-
if (values !== void 0) {
|
|
83
|
-
translated[toTagLibKey(fromTagLibKey(key))] = values;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (!(LYRICS_WIRE_KEY in translated)) {
|
|
87
|
-
const existing = this.handle.getProperties()[LYRICS_WIRE_KEY];
|
|
88
|
-
if (existing !== void 0) translated[LYRICS_WIRE_KEY] = existing;
|
|
89
|
-
}
|
|
90
|
-
const atomNames = mp4FreeformAtomNames(Object.keys(translated));
|
|
91
|
-
if (atomNames.length > 0) translated[MP4_ITEM_NAMES_KEY] = atomNames;
|
|
92
|
-
this.handle.setProperties(translated);
|
|
93
|
-
}
|
|
94
|
-
getProperty(key) {
|
|
95
|
-
const wireKey = toTagLibKey(fromTagLibKey(key));
|
|
96
|
-
const values = this.handle.getProperties()[wireKey]?.filter(
|
|
97
|
-
(v) => v !== ""
|
|
98
|
-
);
|
|
99
|
-
if (values !== void 0 && values.length > 0) return values;
|
|
100
|
-
if (!this.isMP4()) return void 0;
|
|
101
|
-
const remapped = this.properties()[key]?.filter((v) => v !== "");
|
|
102
|
-
return remapped !== void 0 && remapped.length > 0 ? remapped : void 0;
|
|
103
|
-
}
|
|
104
|
-
setProperty(key, value) {
|
|
105
|
-
const wireKey = toTagLibKey(fromTagLibKey(key));
|
|
106
|
-
const atomNames = mp4FreeformAtomNames([wireKey]);
|
|
107
|
-
if (atomNames.length > 0 && this.isMP4()) {
|
|
108
|
-
if (value === "") {
|
|
109
|
-
const prior = this.handle.getMp4ItemRemovals?.() ?? [];
|
|
110
|
-
this.handle.setMp4ItemRemovals?.([
|
|
111
|
-
.../* @__PURE__ */ new Set([...prior, ...atomNames])
|
|
112
|
-
]);
|
|
113
|
-
if (this.module.isWasi) {
|
|
114
|
-
this.handle.setProperties({
|
|
115
|
-
...this.handle.getProperties(),
|
|
116
|
-
[wireKey]: []
|
|
117
|
-
});
|
|
118
|
-
} else {
|
|
119
|
-
const rest = { ...this.handle.getProperties() };
|
|
120
|
-
delete rest[wireKey];
|
|
121
|
-
this.handle.setProperties(rest);
|
|
122
|
-
}
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
this.handle.setProperties({
|
|
126
|
-
...this.handle.getProperties(),
|
|
127
|
-
[wireKey]: [value],
|
|
128
|
-
[MP4_ITEM_NAMES_KEY]: atomNames
|
|
129
|
-
});
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
this.handle.setProperty(wireKey, value);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* The empty-string clearing contract, named (taglib-qyw2): both backends
|
|
136
|
-
* remove the property when the written value is empty, and setProperty's
|
|
137
|
-
* wire-key normalization + MP4 freeform atom-name handling apply unchanged.
|
|
138
|
-
*/
|
|
139
|
-
removeProperty(key) {
|
|
140
|
-
this.setProperty(key, "");
|
|
141
|
-
}
|
|
142
|
-
isMP4() {
|
|
143
|
-
return this.handle.isMP4();
|
|
144
|
-
}
|
|
145
|
-
getMP4Item(key) {
|
|
146
|
-
if (!this.isMP4()) {
|
|
147
|
-
throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
|
|
148
|
-
}
|
|
149
|
-
const wireKey = mp4AtomWireKey(key);
|
|
150
|
-
const value = wireKey !== void 0 ? this.handle.getProperty(wireKey) : this.handle.getMP4Item(key);
|
|
151
|
-
return value === "" ? void 0 : value;
|
|
152
|
-
}
|
|
153
|
-
setMP4Item(key, value) {
|
|
154
|
-
if (!this.isMP4()) {
|
|
155
|
-
throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
|
|
156
|
-
}
|
|
157
|
-
const wireKey = mp4AtomWireKey(key);
|
|
158
|
-
if (wireKey !== void 0) {
|
|
159
|
-
this.handle.setProperty(wireKey, value);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
this.handle.setMP4Item(key, value);
|
|
163
|
-
}
|
|
164
|
-
removeMP4Item(key) {
|
|
165
|
-
if (!this.isMP4()) {
|
|
166
|
-
throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
|
|
167
|
-
}
|
|
168
|
-
this.handle.removeMP4Item(key);
|
|
169
|
-
}
|
|
170
|
-
isValid() {
|
|
171
|
-
return this.handle.isValid();
|
|
172
|
-
}
|
|
173
|
-
dispose() {
|
|
174
|
-
unregisterAutoDispose(this);
|
|
175
|
-
if (this.fileHandle) {
|
|
176
|
-
this.fileHandle.destroy();
|
|
177
|
-
this.fileHandle = null;
|
|
178
|
-
this.cachedAudioProperties = null;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
[Symbol.dispose]() {
|
|
182
|
-
this.dispose();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
export {
|
|
186
|
-
BaseAudioFileImpl
|
|
187
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-file-bwf.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-bwf.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAc/D,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAGtE;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,GAAG,IAAI,GACtB,IAAI,CAGN;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,UAAU,GACjB,uBAAuB,GAAG,SAAS,CAGrC;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,uBAAuB,GAC5B,IAAI,CAGN;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAE9D;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,IAAI,GAClB,IAAI,CAGN"}
|