taglib-wasm 2.3.0 → 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 +70 -64
- 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.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 +29 -30
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +4101 -4478
- package/dist/index.d.ts +26 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -185
- 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/runtime/wasi-adapter/adapter.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/adapter.js +114 -0
- 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.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/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.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/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 +3404 -3692
- 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.map +1 -0
- package/dist/taglib/audio-file-checksum.js +90 -0
- package/dist/taglib/audio-file-impl.d.ts.map +1 -0
- package/dist/taglib/audio-file-impl.js +234 -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.map +1 -0
- package/dist/taglib/media-ranges.js +309 -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-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.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/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 +5 -5
- package/dist/web.browser.d.ts.map +1 -1
- package/dist/web.browser.js +3168 -3411
- package/dist/web.d.ts +1 -1
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +5 -2
- package/package.json +131 -96
- 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.map +0 -1
- package/dist/src/errors/base.js +0 -49
- 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 -130
- package/dist/src/runtime/wasi-adapter/audio-properties.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/audio-properties.js +0 -102
- 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/path-open.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/path-open.js +0 -76
- 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 -257
- 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 -114
- 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/checksum-operations.d.ts.map +0 -1
- package/dist/src/simple/checksum-operations.js +0 -7
- 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 -60
- 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-checksum.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-checksum.js +0 -77
- package/dist/src/taglib/audio-file-impl.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-impl.js +0 -317
- 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/media-ranges.d.ts.map +0 -1
- package/dist/src/taglib/media-ranges.js +0 -192
- package/dist/src/taglib/metadata-extent.d.ts.map +0 -1
- package/dist/src/taglib/metadata-extent.js +0 -189
- 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 -195
- 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.map +0 -1
- package/dist/src/utils/path.js +0 -36
- 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}/base.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/adapter.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/audio-properties.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/path-open.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/runtime → runtime}/wasmer-sdk-loader/types.d.ts +0 -0
- /package/dist/{src/simple → simple}/batch-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/checksum-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/config.d.ts +0 -0
- /package/dist/{src/simple → simple}/index.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}/audio-file-checksum.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-impl.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-interface.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}/media-ranges.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/metadata-extent.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}/path.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/wasm.d.ts → wasm.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,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"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { decodeBext, encodeBext } from "../bwf/bext.js";
|
|
2
|
-
import { UnsupportedFormatError } from "../errors.js";
|
|
3
|
-
const BWF_FORMATS = /* @__PURE__ */ new Set(["WAV", "FLAC"]);
|
|
4
|
-
function requireBwf(format) {
|
|
5
|
-
if (!BWF_FORMATS.has(format)) {
|
|
6
|
-
throw new UnsupportedFormatError(format, ["WAV", "FLAC"], {
|
|
7
|
-
operation: "BWF metadata"
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function getBextData(handle) {
|
|
12
|
-
const raw = handle.getBextData();
|
|
13
|
-
return raw && raw.length > 0 ? raw : void 0;
|
|
14
|
-
}
|
|
15
|
-
function setBextData(handle, format, data) {
|
|
16
|
-
requireBwf(format);
|
|
17
|
-
handle.setBextData(data);
|
|
18
|
-
}
|
|
19
|
-
function getBext(handle) {
|
|
20
|
-
const raw = handle.getBextData();
|
|
21
|
-
return raw && raw.length > 0 ? decodeBext(raw) : void 0;
|
|
22
|
-
}
|
|
23
|
-
function setBext(handle, format, bext) {
|
|
24
|
-
requireBwf(format);
|
|
25
|
-
handle.setBextData(encodeBext(bext));
|
|
26
|
-
}
|
|
27
|
-
function getIxml(handle) {
|
|
28
|
-
return handle.getIxml();
|
|
29
|
-
}
|
|
30
|
-
function setIxml(handle, format, data) {
|
|
31
|
-
requireBwf(format);
|
|
32
|
-
handle.setIxml(data);
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
getBext,
|
|
36
|
-
getBextData,
|
|
37
|
-
getIxml,
|
|
38
|
-
setBext,
|
|
39
|
-
setBextData,
|
|
40
|
-
setIxml
|
|
41
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-file-checksum.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-checksum.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,MAAM,MAAM,aAAa,GACrB;IACA,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,SAAS,EAAE,QAAQ,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB,GACC;IACA,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,EAAE,KAAK,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,EAAE,CAAC;CACjB,CAAC;AAEJ,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC;CAC3B;AAED;mCACmC;AACnC,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;AAErD,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAE3D;;;;GAIG;AACH,UAAU,oBAAoB;IAC5B;sEACkE;IAClE,KAAK,EAAE,UAAU,CAAC;IAClB,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;2DAEuD;IACvD,eAAe,EAAE,OAAO,CAAC;CAC1B;AA6FD,wBAAsB,aAAa,CACjC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,UAAU,EACd,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,aAAa,CAAC,CAoExB"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { flacStreamInfoMd5, mediaRanges } from "./media-ranges.js";
|
|
2
|
-
import { MetadataError, UnsupportedFormatError } from "../errors.js";
|
|
3
|
-
const STREAMINFO_WINDOW = 65536;
|
|
4
|
-
async function fileBytes(source, io) {
|
|
5
|
-
if (source.path) return await io.readFile(source.path);
|
|
6
|
-
if (source.blob) return new Uint8Array(await source.blob.arrayBuffer());
|
|
7
|
-
if (!source.partiallyLoaded && source.bytes.length > 0) return source.bytes;
|
|
8
|
-
throw new MetadataError(
|
|
9
|
-
"read",
|
|
10
|
-
"the handle holds no file bytes and has no readable source; a partial handle that has been saved drops its source \u2014 checksum the saved path instead"
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
function joinRanges(bytes, ranges) {
|
|
14
|
-
const total = ranges.reduce((n, r) => n + r.length, 0);
|
|
15
|
-
const overrun = ranges.find((r) => r.offset + r.length > bytes.length);
|
|
16
|
-
if (overrun || total > bytes.length) {
|
|
17
|
-
throw new MetadataError(
|
|
18
|
-
"read",
|
|
19
|
-
`range walk overran the buffer (${overrun ? `range ${overrun.offset}+${overrun.length}` : `${total} bytes`} past the ${bytes.length}-byte buffer)`
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
if (ranges.length === 1) {
|
|
23
|
-
const only = ranges[0];
|
|
24
|
-
const view = bytes.subarray(only.offset, only.offset + only.length);
|
|
25
|
-
return view.buffer instanceof ArrayBuffer ? view : new Uint8Array(view);
|
|
26
|
-
}
|
|
27
|
-
const out = new Uint8Array(total);
|
|
28
|
-
let at = 0;
|
|
29
|
-
for (const r of ranges) {
|
|
30
|
-
out.set(bytes.subarray(r.offset, r.offset + r.length), at);
|
|
31
|
-
at += r.length;
|
|
32
|
-
}
|
|
33
|
-
return out;
|
|
34
|
-
}
|
|
35
|
-
async function mediaChecksum(source, format, io, options = {}) {
|
|
36
|
-
if (options.basis === "pcm") {
|
|
37
|
-
if (format.toUpperCase() !== "FLAC") {
|
|
38
|
-
throw new UnsupportedFormatError(format, ["FLAC"], {
|
|
39
|
-
operation: "media checksum (basis: pcm)"
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
const windowed = source.bytes.length > 0 ? source.bytes : source.path && io.readPartial ? await io.readPartial(source.path, STREAMINFO_WINDOW, 0) : void 0;
|
|
43
|
-
let md5 = windowed === void 0 ? void 0 : flacStreamInfoMd5(windowed);
|
|
44
|
-
if (md5 === void 0 && windowed !== source.bytes) {
|
|
45
|
-
md5 = flacStreamInfoMd5(await fileBytes(source, io));
|
|
46
|
-
}
|
|
47
|
-
if (md5 === void 0) {
|
|
48
|
-
throw new MetadataError(
|
|
49
|
-
"read",
|
|
50
|
-
"STREAMINFO digest unavailable"
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
source: "flac-streaminfo-md5",
|
|
55
|
-
algorithm: "md5",
|
|
56
|
-
hex: md5,
|
|
57
|
-
bytesHashed: 16
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
const bytes = await fileBytes(source, io);
|
|
61
|
-
const walk = mediaRanges(format, bytes);
|
|
62
|
-
const payload = joinRanges(bytes, walk.ranges);
|
|
63
|
-
const digest = new Uint8Array(
|
|
64
|
-
await crypto.subtle.digest("SHA-256", payload)
|
|
65
|
-
);
|
|
66
|
-
let hex = "";
|
|
67
|
-
for (const byte of digest) hex += byte.toString(16).padStart(2, "0");
|
|
68
|
-
return {
|
|
69
|
-
source: walk.kind === "ranges" ? "audio-payload" : "file",
|
|
70
|
-
algorithm: "sha256",
|
|
71
|
-
hex,
|
|
72
|
-
bytesHashed: payload.length
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
export {
|
|
76
|
-
mediaChecksum
|
|
77
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-file-impl.d.ts","sourceRoot":"","sources":["../../../src/taglib/audio-file-impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,cAAc,EACf,MAAM,oCAAoC,CAAC;AAc5C,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAqBlC,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CASrD;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,iBAAkB,YAAW,SAAS;IACvE,OAAO,CAAC,cAAc,CAA2B;IACjD,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAU;gBAGtD,MAAM,EAAE,YAAY,EACpB,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;IAalC,IAAI,IAAI,OAAO;IAef,aAAa,IAAI,UAAU;IA2B3B,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC;IA2B/D,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4D9C,WAAW,IAAI,OAAO,EAAE;IAYxB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAStC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IASlC,cAAc,IAAI,IAAI;IAItB,WAAW,IAAI,OAAO,EAAE;IAqBxB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI;IA0BpE,OAAO,IAAI,uBAAuB,GAAG,SAAS;IAI9C,OAAO,CAAC,IAAI,EAAE,uBAAuB,GAAG,IAAI;IAI5C,WAAW,IAAI,UAAU,GAAG,SAAS;IAIrC,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI;IAI1C,OAAO,IAAI,MAAM,GAAG,SAAS;IAI7B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIlC,UAAU,IAAI,MAAM,EAAE;IAWtB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAQnC,SAAS,IAAI,cAAc,EAAE;IAS7B,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI;IAQzC,SAAS,IAAI,gBAAgB,GAAG,SAAS;IAKzC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/C,cAAc,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE;IAMzC,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI;IAOpD,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMnC,UAAU,IAAI;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAA;KAAE;IAI1C,YAAY,CAAC,IAAI,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAM1D"}
|
|
@@ -1,317 +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 { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES } from "../types.js";
|
|
5
|
-
import * as bwf from "./audio-file-bwf.js";
|
|
6
|
-
import {
|
|
7
|
-
assertFrameBodies,
|
|
8
|
-
assertFrameId,
|
|
9
|
-
assertMp3,
|
|
10
|
-
toPublicFrame
|
|
11
|
-
} from "./id3v2-frames.js";
|
|
12
|
-
import {
|
|
13
|
-
errorMessage,
|
|
14
|
-
FileOperationError,
|
|
15
|
-
UnsupportedFormatError
|
|
16
|
-
} from "../errors.js";
|
|
17
|
-
import { writeFileData } from "../utils/write.js";
|
|
18
|
-
import { getNodeFsSync } from "../utils/node-fs.js";
|
|
19
|
-
import { normalized } from "../utils/rating.js";
|
|
20
|
-
import { isDeno } from "../runtime/detector.js";
|
|
21
|
-
import { BaseAudioFileImpl } from "./audio-file-base.js";
|
|
22
|
-
import {
|
|
23
|
-
mediaChecksum
|
|
24
|
-
} from "./audio-file-checksum.js";
|
|
25
|
-
import { getPlatformIO } from "../runtime/platform-io.js";
|
|
26
|
-
import { saveViaFreshHandle } from "./save-reconstruct.js";
|
|
27
|
-
function sortChapters(list) {
|
|
28
|
-
return [...list].sort((a, b) => a.startTimeMs - b.startTimeMs);
|
|
29
|
-
}
|
|
30
|
-
function inferEndTimeMs(sorted, index, trackEndMs) {
|
|
31
|
-
const own = sorted[index].endTimeMs;
|
|
32
|
-
if (own !== void 0) return own;
|
|
33
|
-
const next = sorted[index + 1];
|
|
34
|
-
return next ? next.startTimeMs : trackEndMs;
|
|
35
|
-
}
|
|
36
|
-
function readFileSync(path) {
|
|
37
|
-
if (isDeno()) return Deno.readFileSync(path);
|
|
38
|
-
const fs = getNodeFsSync();
|
|
39
|
-
if (fs) return new Uint8Array(fs.readFileSync(path));
|
|
40
|
-
throw new FileOperationError(
|
|
41
|
-
"read",
|
|
42
|
-
"node:fs is unavailable in this runtime: cannot read file data from disk",
|
|
43
|
-
path
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
class AudioFileImpl extends BaseAudioFileImpl {
|
|
47
|
-
constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
|
|
48
|
-
super(
|
|
49
|
-
module,
|
|
50
|
-
fileHandle,
|
|
51
|
-
sourcePath,
|
|
52
|
-
originalSource,
|
|
53
|
-
isPartiallyLoaded,
|
|
54
|
-
partialLoadOptions
|
|
55
|
-
);
|
|
56
|
-
__publicField(this, "pathModeBuffer", null);
|
|
57
|
-
/** How the handle was loaded — `isPartiallyLoaded` is mutated by saveToFile(). */
|
|
58
|
-
__publicField(this, "partiallyLoadedAtConstruction");
|
|
59
|
-
this.partiallyLoadedAtConstruction = isPartiallyLoaded;
|
|
60
|
-
}
|
|
61
|
-
save() {
|
|
62
|
-
if (this.isPartiallyLoaded && this.originalSource) {
|
|
63
|
-
throw new FileOperationError(
|
|
64
|
-
"save",
|
|
65
|
-
"Cannot save partially loaded file directly. Use saveToFile() instead"
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
this.cachedAudioProperties = null;
|
|
69
|
-
this.pathModeBuffer = null;
|
|
70
|
-
return this.handle.save();
|
|
71
|
-
}
|
|
72
|
-
getFileBuffer() {
|
|
73
|
-
const buffer = this.handle.getBuffer();
|
|
74
|
-
if (buffer.length > 0) return buffer;
|
|
75
|
-
if (this.pathModeBuffer) return this.pathModeBuffer;
|
|
76
|
-
if (this.sourcePath) {
|
|
77
|
-
try {
|
|
78
|
-
this.pathModeBuffer = readFileSync(this.sourcePath);
|
|
79
|
-
return this.pathModeBuffer;
|
|
80
|
-
} catch (error) {
|
|
81
|
-
if (error instanceof FileOperationError) throw error;
|
|
82
|
-
throw new FileOperationError(
|
|
83
|
-
"read",
|
|
84
|
-
`Cannot return file data: ${errorMessage(error)}`,
|
|
85
|
-
this.sourcePath,
|
|
86
|
-
{ cause: error }
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
throw new FileOperationError(
|
|
91
|
-
"read",
|
|
92
|
-
"No file data available: in-memory buffer is empty and no source path is set"
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
mediaChecksum(options) {
|
|
96
|
-
return mediaChecksum(
|
|
97
|
-
{
|
|
98
|
-
// The cheap, no-IO accessor — `getFileBuffer()` would read the whole
|
|
99
|
-
// file from disk in path mode (and cache it), which the source rule is
|
|
100
|
-
// about to read for itself.
|
|
101
|
-
bytes: this.handle.getBuffer(),
|
|
102
|
-
// empty in path mode: the data is on disk
|
|
103
|
-
// Both optional fields are conditional: they are `undefined` far more
|
|
104
|
-
// often than not, and `exactOptionalPropertyTypes` refuses an explicit
|
|
105
|
-
// `undefined` on an optional property.
|
|
106
|
-
...this.sourcePath !== void 0 ? { path: this.sourcePath } : {},
|
|
107
|
-
// originalSource is the File when the caller passed one. A partial File
|
|
108
|
-
// has no path, so this is the only way back to the real bytes.
|
|
109
|
-
...this.originalSource instanceof Blob ? { blob: this.originalSource } : {},
|
|
110
|
-
// Captured at construction, NOT this.isPartiallyLoaded: saveToFile() sets
|
|
111
|
-
// that flag false (and clears originalSource) while the handle still holds
|
|
112
|
-
// the spliced image, which would make the source rule hash the image.
|
|
113
|
-
partiallyLoaded: this.partiallyLoadedAtConstruction
|
|
114
|
-
},
|
|
115
|
-
this.getFormat(),
|
|
116
|
-
getPlatformIO(),
|
|
117
|
-
options
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
async saveToFile(path) {
|
|
121
|
-
const targetPath = path ?? this.sourcePath;
|
|
122
|
-
if (!targetPath) {
|
|
123
|
-
throw new FileOperationError(
|
|
124
|
-
"save",
|
|
125
|
-
"No file path available. Provide a path or open the file from a path"
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
if (this.isPartiallyLoaded && this.originalSource) {
|
|
129
|
-
await saveViaFreshHandle(
|
|
130
|
-
this.module,
|
|
131
|
-
this.handle,
|
|
132
|
-
this.originalSource,
|
|
133
|
-
targetPath,
|
|
134
|
-
false,
|
|
135
|
-
this.partialDeletedPropertyKeys()
|
|
136
|
-
);
|
|
137
|
-
this.isPartiallyLoaded = false;
|
|
138
|
-
this.originalSource = void 0;
|
|
139
|
-
} else if (this.module.isWasi && this.sourcePath && targetPath !== this.sourcePath) {
|
|
140
|
-
await saveViaFreshHandle(
|
|
141
|
-
this.module,
|
|
142
|
-
this.handle,
|
|
143
|
-
this.sourcePath,
|
|
144
|
-
targetPath,
|
|
145
|
-
true
|
|
146
|
-
);
|
|
147
|
-
} else {
|
|
148
|
-
if (!this.save()) {
|
|
149
|
-
throw new FileOperationError(
|
|
150
|
-
"save",
|
|
151
|
-
"Failed to save changes to in-memory buffer"
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
const buffer = this.handle.getBuffer();
|
|
155
|
-
if (buffer.length > 0) {
|
|
156
|
-
await writeFileData(targetPath, buffer);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
this.pathModeBuffer = null;
|
|
160
|
-
}
|
|
161
|
-
getPictures() {
|
|
162
|
-
const picturesArray = this.handle.getPictures();
|
|
163
|
-
return picturesArray.map((pic) => ({
|
|
164
|
-
mimeType: pic.mimeType,
|
|
165
|
-
data: pic.data,
|
|
166
|
-
type: PICTURE_TYPE_NAMES[pic.type] ?? "Other",
|
|
167
|
-
...pic.description !== void 0 ? { description: pic.description } : {}
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
setPictures(pictures) {
|
|
171
|
-
this.handle.setPictures(pictures.map((pic) => ({
|
|
172
|
-
mimeType: pic.mimeType,
|
|
173
|
-
data: pic.data,
|
|
174
|
-
type: PICTURE_TYPE_VALUES[pic.type] ?? 0,
|
|
175
|
-
description: pic.description ?? ""
|
|
176
|
-
})));
|
|
177
|
-
}
|
|
178
|
-
addPicture(picture) {
|
|
179
|
-
this.handle.addPicture({
|
|
180
|
-
mimeType: picture.mimeType,
|
|
181
|
-
data: picture.data,
|
|
182
|
-
type: PICTURE_TYPE_VALUES[picture.type] ?? 0,
|
|
183
|
-
description: picture.description ?? ""
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
removePictures() {
|
|
187
|
-
this.handle.removePictures();
|
|
188
|
-
}
|
|
189
|
-
getChapters() {
|
|
190
|
-
const sorted = sortChapters(this.handle.getChapters());
|
|
191
|
-
const trackEndMs = this.audioProperties()?.durationMs;
|
|
192
|
-
return sorted.map((c, i) => {
|
|
193
|
-
const endTimeMs = inferEndTimeMs(sorted, i, trackEndMs);
|
|
194
|
-
return {
|
|
195
|
-
startTimeMs: c.startTimeMs,
|
|
196
|
-
...endTimeMs !== void 0 ? { endTimeMs } : {},
|
|
197
|
-
// Truthiness, not !== undefined: an empty CHAP title/id must read back
|
|
198
|
-
// as ABSENT (the old `c.title || undefined` contract; the Embind
|
|
199
|
-
// reader emits "" unconditionally, WASI omits — coalescing keeps the
|
|
200
|
-
// backends agreeing).
|
|
201
|
-
...c.title ? { title: c.title } : {},
|
|
202
|
-
...c.id ? { id: c.id } : {},
|
|
203
|
-
...c.source !== void 0 ? { source: c.source } : {}
|
|
204
|
-
};
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
setChapters(chapters, options) {
|
|
208
|
-
const fmt = this.getFormat();
|
|
209
|
-
if (fmt !== "MP3" && fmt !== "AAC" && fmt !== "MP4") {
|
|
210
|
-
throw new UnsupportedFormatError(fmt, ["MP3", "AAC", "MP4"], {
|
|
211
|
-
operation: "setChapters"
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
const sorted = sortChapters(chapters);
|
|
215
|
-
const trackEndMs = this.audioProperties()?.durationMs;
|
|
216
|
-
const style = options?.mp4ChapterStyle ?? "quicktime";
|
|
217
|
-
const source = fmt === "MP4" ? style : "id3";
|
|
218
|
-
const raw = sorted.map((c, i) => ({
|
|
219
|
-
...c.id !== void 0 ? { id: c.id } : {},
|
|
220
|
-
startTimeMs: c.startTimeMs,
|
|
221
|
-
endTimeMs: inferEndTimeMs(sorted, i, trackEndMs) ?? c.startTimeMs,
|
|
222
|
-
...c.title !== void 0 ? { title: c.title } : {},
|
|
223
|
-
source
|
|
224
|
-
}));
|
|
225
|
-
this.handle.setChapters(raw, style);
|
|
226
|
-
}
|
|
227
|
-
getBext() {
|
|
228
|
-
return bwf.getBext(this.handle);
|
|
229
|
-
}
|
|
230
|
-
setBext(bext) {
|
|
231
|
-
bwf.setBext(this.handle, this.getFormat(), bext);
|
|
232
|
-
}
|
|
233
|
-
getBextData() {
|
|
234
|
-
return bwf.getBextData(this.handle);
|
|
235
|
-
}
|
|
236
|
-
setBextData(data) {
|
|
237
|
-
bwf.setBextData(this.handle, this.getFormat(), data);
|
|
238
|
-
}
|
|
239
|
-
getIxml() {
|
|
240
|
-
return bwf.getIxml(this.handle);
|
|
241
|
-
}
|
|
242
|
-
setIxml(data) {
|
|
243
|
-
bwf.setIxml(this.handle, this.getFormat(), data);
|
|
244
|
-
}
|
|
245
|
-
getRatings() {
|
|
246
|
-
return this.handle.getRatings().map(
|
|
247
|
-
(r) => ({
|
|
248
|
-
rating: r.rating,
|
|
249
|
-
...r.email !== void 0 && r.email !== "" ? { email: r.email } : {},
|
|
250
|
-
// 0 must read back as ABSENT (old `r.counter || undefined` contract).
|
|
251
|
-
...r.counter !== 0 ? { counter: r.counter } : {}
|
|
252
|
-
})
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
setRatings(ratings) {
|
|
256
|
-
this.handle.setRatings(ratings.map((r) => ({
|
|
257
|
-
rating: r.rating,
|
|
258
|
-
email: r.email ?? "",
|
|
259
|
-
counter: r.counter ?? 0
|
|
260
|
-
})));
|
|
261
|
-
}
|
|
262
|
-
getLyrics() {
|
|
263
|
-
return this.handle.getLyrics().map((l) => {
|
|
264
|
-
const out = { text: l.text };
|
|
265
|
-
if (l.description) out.description = l.description;
|
|
266
|
-
if (l.language) out.language = l.language;
|
|
267
|
-
return out;
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
setLyrics(lyrics) {
|
|
271
|
-
this.handle.setLyrics(lyrics.map((l) => ({
|
|
272
|
-
text: l.text,
|
|
273
|
-
description: l.description ?? "",
|
|
274
|
-
language: l.language ?? ""
|
|
275
|
-
})));
|
|
276
|
-
}
|
|
277
|
-
getRating() {
|
|
278
|
-
const ratings = this.getRatings();
|
|
279
|
-
return ratings.length > 0 ? normalized(ratings[0].rating) : void 0;
|
|
280
|
-
}
|
|
281
|
-
setRating(rating, email) {
|
|
282
|
-
this.setRatings([{
|
|
283
|
-
rating,
|
|
284
|
-
...email !== void 0 ? { email } : {},
|
|
285
|
-
counter: 0
|
|
286
|
-
}]);
|
|
287
|
-
}
|
|
288
|
-
getId3v2Frames(id) {
|
|
289
|
-
assertMp3(this.getFormat());
|
|
290
|
-
if (id !== void 0) assertFrameId(id, "read");
|
|
291
|
-
return this.handle.getId3v2Frames(id ?? "").map(toPublicFrame);
|
|
292
|
-
}
|
|
293
|
-
setId3v2Frames(id, data) {
|
|
294
|
-
assertMp3(this.getFormat());
|
|
295
|
-
assertFrameId(id, "write");
|
|
296
|
-
assertFrameBodies(id, data);
|
|
297
|
-
this.handle.setId3v2Frames(id, data);
|
|
298
|
-
}
|
|
299
|
-
removeId3v2Frames(id) {
|
|
300
|
-
assertMp3(this.getFormat());
|
|
301
|
-
assertFrameId(id, "write");
|
|
302
|
-
this.handle.removeId3v2Frames(id);
|
|
303
|
-
}
|
|
304
|
-
hasId3Tags() {
|
|
305
|
-
return this.handle.hasId3Tags();
|
|
306
|
-
}
|
|
307
|
-
stripId3Tags(opts) {
|
|
308
|
-
this.handle.stripId3Tags({
|
|
309
|
-
v1: opts?.v1 ?? true,
|
|
310
|
-
v2: opts?.v2 ?? true
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
export {
|
|
315
|
-
AudioFileImpl,
|
|
316
|
-
readFileSync
|
|
317
|
-
};
|