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
package/dist/simple.d.ts
CHANGED
package/dist/simple.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../simple.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["../src/simple.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,mBAAmB,CAAC"}
|
package/dist/simple.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES } from "./types/pictures.js";
|
|
2
|
+
import { getTagLib, setBufferMode } from "./simple/config.js";
|
|
3
|
+
import { applyTags, applyTagsToFile, clearTags, isValidAudioFile, readFormat, readProperties, readTags } from "./simple/tag-operations.js";
|
|
4
|
+
import { addPicture, applyCoverArt, applyPictures, clearPictures, findPictureByType, readCoverArt, readPictureMetadata, readPictures, replacePictureByType } from "./simple/picture-operations.js";
|
|
5
|
+
import { editTagsBatch, readMetadata, readMetadataBatch, readPropertiesBatch, readTagsBatch, writeTagsBatch } from "./simple/batch-operations.js";
|
|
6
|
+
import { readMediaChecksum } from "./simple/checksum-operations.js";
|
|
7
|
+
import "./simple/index.js";
|
|
8
|
+
export { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES, addPicture, applyCoverArt, applyPictures, applyTags, applyTagsToFile, clearPictures, clearTags, editTagsBatch, findPictureByType, getTagLib, isValidAudioFile, readCoverArt, readFormat, readMediaChecksum, readMetadata, readMetadataBatch, readPictureMetadata, readPictures, readProperties, readPropertiesBatch, readTags, readTagsBatch, replacePictureByType, setBufferMode, writeTagsBatch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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;IA6B9C,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;IAgB3C,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"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { fromTagLibKey, mp4AtomWireKey, mp4FreeformAtomNames, remapKeysFromTagLib, toTagLibKey } from "../constants/properties.js";
|
|
2
|
+
import { MetadataError, UnsupportedFormatError } from "../errors/classes.js";
|
|
3
|
+
import "../errors.js";
|
|
4
|
+
import { MP4_ITEM_NAMES_KEY } from "./mp4-item-names.js";
|
|
5
|
+
import { buildMutableTag } from "./mutable-tag-impl.js";
|
|
6
|
+
import { registerAutoDispose, unregisterAutoDispose } from "./auto-dispose.js";
|
|
7
|
+
import _defineProperty from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js";
|
|
8
|
+
//#region src/taglib/audio-file-base.ts
|
|
9
|
+
let _Symbol$dispose;
|
|
10
|
+
const LYRICS_PROPERTY_KEY = "lyrics";
|
|
11
|
+
const LYRICS_WIRE_KEY = toTagLibKey(LYRICS_PROPERTY_KEY);
|
|
12
|
+
const EMPTY_KEY_SET = /* @__PURE__ */ new Set();
|
|
13
|
+
_Symbol$dispose = Symbol.dispose;
|
|
14
|
+
/**
|
|
15
|
+
* Base implementation with core read/property operations.
|
|
16
|
+
* Extended by AudioFileImpl to add save/picture/rating/extended methods.
|
|
17
|
+
*
|
|
18
|
+
* @internal Not exported from the public API.
|
|
19
|
+
*/
|
|
20
|
+
var BaseAudioFileImpl = class {
|
|
21
|
+
constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
|
|
22
|
+
this.module = module;
|
|
23
|
+
_defineProperty(this, "fileHandle", void 0);
|
|
24
|
+
_defineProperty(this, "cachedAudioProperties", null);
|
|
25
|
+
_defineProperty(this, "sourcePath", void 0);
|
|
26
|
+
_defineProperty(this, "originalSource", void 0);
|
|
27
|
+
_defineProperty(this, "isPartiallyLoaded", false);
|
|
28
|
+
_defineProperty(this, "partialLoadOptions", void 0);
|
|
29
|
+
_defineProperty(this, "partialKeysAtLoad", void 0);
|
|
30
|
+
this.fileHandle = fileHandle;
|
|
31
|
+
this.sourcePath = sourcePath;
|
|
32
|
+
this.originalSource = originalSource;
|
|
33
|
+
this.isPartiallyLoaded = isPartiallyLoaded;
|
|
34
|
+
this.partialLoadOptions = partialLoadOptions;
|
|
35
|
+
this.partialKeysAtLoad = isPartiallyLoaded ? new Set(Object.keys(fileHandle.getProperties())) : void 0;
|
|
36
|
+
registerAutoDispose(this, fileHandle);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Wire-key text properties present in the partial header at load but now
|
|
40
|
+
* absent — the user deleted them. The partial-load reconstruct subtracts these
|
|
41
|
+
* from its preserve-the-original merge so a deletion persists without wiping
|
|
42
|
+
* frames beyond the loaded header (taglib-d14). Lyrics are excluded (they ride
|
|
43
|
+
* their own reconstruct path); empty for a full load.
|
|
44
|
+
*/
|
|
45
|
+
partialDeletedPropertyKeys() {
|
|
46
|
+
if (!this.partialKeysAtLoad) return EMPTY_KEY_SET;
|
|
47
|
+
const current = new Set(Object.keys(this.handle.getProperties()));
|
|
48
|
+
const deleted = /* @__PURE__ */ new Set();
|
|
49
|
+
for (const key of this.partialKeysAtLoad) if (key !== LYRICS_WIRE_KEY && !current.has(key)) deleted.add(key);
|
|
50
|
+
return deleted;
|
|
51
|
+
}
|
|
52
|
+
get handle() {
|
|
53
|
+
if (!this.fileHandle) throw new MetadataError("read", "File handle has been disposed");
|
|
54
|
+
return this.fileHandle;
|
|
55
|
+
}
|
|
56
|
+
getFormat() {
|
|
57
|
+
return this.handle.getFormat();
|
|
58
|
+
}
|
|
59
|
+
isFormat(format) {
|
|
60
|
+
return this.getFormat() === format;
|
|
61
|
+
}
|
|
62
|
+
tag() {
|
|
63
|
+
return buildMutableTag(this.handle);
|
|
64
|
+
}
|
|
65
|
+
audioProperties() {
|
|
66
|
+
if (!this.cachedAudioProperties) this.cachedAudioProperties = this.handle.getAudioProperties() ?? null;
|
|
67
|
+
return this.cachedAudioProperties ?? void 0;
|
|
68
|
+
}
|
|
69
|
+
properties() {
|
|
70
|
+
const remapped = remapKeysFromTagLib(this.handle.getProperties());
|
|
71
|
+
delete remapped[LYRICS_PROPERTY_KEY];
|
|
72
|
+
return remapped;
|
|
73
|
+
}
|
|
74
|
+
setProperties(properties) {
|
|
75
|
+
const translated = {};
|
|
76
|
+
for (const [key, values] of Object.entries(properties)) if (values !== void 0) translated[toTagLibKey(fromTagLibKey(key))] = values;
|
|
77
|
+
if (!(LYRICS_WIRE_KEY in translated)) {
|
|
78
|
+
const existing = this.handle.getProperties()[LYRICS_WIRE_KEY];
|
|
79
|
+
if (existing !== void 0) translated[LYRICS_WIRE_KEY] = existing;
|
|
80
|
+
}
|
|
81
|
+
const atomNames = mp4FreeformAtomNames(Object.keys(translated));
|
|
82
|
+
if (atomNames.length > 0) translated[MP4_ITEM_NAMES_KEY] = atomNames;
|
|
83
|
+
this.handle.setProperties(translated);
|
|
84
|
+
}
|
|
85
|
+
getProperty(key) {
|
|
86
|
+
const wireKey = toTagLibKey(fromTagLibKey(key));
|
|
87
|
+
const values = this.handle.getProperties()[wireKey]?.filter((v) => v !== "");
|
|
88
|
+
if (values !== void 0 && values.length > 0) return values;
|
|
89
|
+
if (!this.isMP4()) return void 0;
|
|
90
|
+
const remapped = this.properties()[key]?.filter((v) => v !== "");
|
|
91
|
+
return remapped !== void 0 && remapped.length > 0 ? remapped : void 0;
|
|
92
|
+
}
|
|
93
|
+
setProperty(key, value) {
|
|
94
|
+
const wireKey = toTagLibKey(fromTagLibKey(key));
|
|
95
|
+
const atomNames = mp4FreeformAtomNames([wireKey]);
|
|
96
|
+
if (atomNames.length > 0 && this.isMP4()) {
|
|
97
|
+
if (value === "") {
|
|
98
|
+
const prior = this.handle.getMp4ItemRemovals?.() ?? [];
|
|
99
|
+
this.handle.setMp4ItemRemovals?.([.../* @__PURE__ */ new Set([...prior, ...atomNames])]);
|
|
100
|
+
if (this.module.isWasi) this.handle.setProperties({
|
|
101
|
+
...this.handle.getProperties(),
|
|
102
|
+
[wireKey]: []
|
|
103
|
+
});
|
|
104
|
+
else {
|
|
105
|
+
const rest = { ...this.handle.getProperties() };
|
|
106
|
+
delete rest[wireKey];
|
|
107
|
+
this.handle.setProperties(rest);
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.handle.setProperties({
|
|
112
|
+
...this.handle.getProperties(),
|
|
113
|
+
[wireKey]: [value],
|
|
114
|
+
[MP4_ITEM_NAMES_KEY]: atomNames
|
|
115
|
+
});
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.handle.setProperty(wireKey, value);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The empty-string clearing contract, named (taglib-qyw2): both backends
|
|
122
|
+
* remove the property when the written value is empty, and setProperty's
|
|
123
|
+
* wire-key normalization + MP4 freeform atom-name handling apply unchanged.
|
|
124
|
+
*/
|
|
125
|
+
removeProperty(key) {
|
|
126
|
+
this.setProperty(key, "");
|
|
127
|
+
}
|
|
128
|
+
isMP4() {
|
|
129
|
+
return this.handle.isMP4();
|
|
130
|
+
}
|
|
131
|
+
getMP4Item(key) {
|
|
132
|
+
if (!this.isMP4()) throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
|
|
133
|
+
const wireKey = mp4AtomWireKey(key);
|
|
134
|
+
const value = wireKey !== void 0 ? this.handle.getProperty(wireKey) : this.handle.getMP4Item(key);
|
|
135
|
+
return value === "" ? void 0 : value;
|
|
136
|
+
}
|
|
137
|
+
setMP4Item(key, value) {
|
|
138
|
+
if (!this.isMP4()) throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
|
|
139
|
+
const wireKey = mp4AtomWireKey(key);
|
|
140
|
+
if (wireKey !== void 0) {
|
|
141
|
+
this.handle.setProperty(wireKey, value);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
this.handle.setMP4Item(key, value);
|
|
145
|
+
}
|
|
146
|
+
removeMP4Item(key) {
|
|
147
|
+
if (!this.isMP4()) throw new UnsupportedFormatError(this.getFormat(), ["MP4", "M4A"]);
|
|
148
|
+
this.handle.removeMP4Item(key);
|
|
149
|
+
}
|
|
150
|
+
isValid() {
|
|
151
|
+
return this.handle.isValid();
|
|
152
|
+
}
|
|
153
|
+
dispose() {
|
|
154
|
+
unregisterAutoDispose(this);
|
|
155
|
+
if (this.fileHandle) {
|
|
156
|
+
this.fileHandle.destroy();
|
|
157
|
+
this.fileHandle = null;
|
|
158
|
+
this.cachedAudioProperties = null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
[_Symbol$dispose]() {
|
|
162
|
+
this.dispose();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
//#endregion
|
|
166
|
+
export { BaseAudioFileImpl };
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { decodeBext, encodeBext } from "../bwf/bext.js";
|
|
2
|
+
import { UnsupportedFormatError } from "../errors/classes.js";
|
|
3
|
+
import "../errors.js";
|
|
4
|
+
//#region src/taglib/audio-file-bwf.ts
|
|
5
|
+
const BWF_FORMATS = /* @__PURE__ */ new Set(["WAV", "FLAC"]);
|
|
6
|
+
function requireBwf(format) {
|
|
7
|
+
if (!BWF_FORMATS.has(format)) throw new UnsupportedFormatError(format, ["WAV", "FLAC"], { operation: "BWF metadata" });
|
|
8
|
+
}
|
|
9
|
+
function getBextData(handle) {
|
|
10
|
+
const raw = handle.getBextData();
|
|
11
|
+
return raw && raw.length > 0 ? raw : void 0;
|
|
12
|
+
}
|
|
13
|
+
function setBextData(handle, format, data) {
|
|
14
|
+
requireBwf(format);
|
|
15
|
+
handle.setBextData(data);
|
|
16
|
+
}
|
|
17
|
+
function getBext(handle) {
|
|
18
|
+
const raw = handle.getBextData();
|
|
19
|
+
return raw && raw.length > 0 ? decodeBext(raw) : void 0;
|
|
20
|
+
}
|
|
21
|
+
function setBext(handle, format, bext) {
|
|
22
|
+
requireBwf(format);
|
|
23
|
+
handle.setBextData(encodeBext(bext));
|
|
24
|
+
}
|
|
25
|
+
function getIxml(handle) {
|
|
26
|
+
return handle.getIxml();
|
|
27
|
+
}
|
|
28
|
+
function setIxml(handle, format, data) {
|
|
29
|
+
requireBwf(format);
|
|
30
|
+
handle.setIxml(data);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { getBext, getBextData, getIxml, setBext, setBextData, setIxml };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `mediaChecksum()`: a SHA-256 of a file's *encoded media
|
|
3
|
+
* payload* — the bytes that are the audio, and not the tags around them — plus
|
|
4
|
+
* FLAC's STREAMINFO digest passthrough. Factored out of `AudioFileImpl` so the
|
|
5
|
+
* source rule below (what actually gets hashed) is stated exactly once.
|
|
6
|
+
*/
|
|
7
|
+
import type { PlatformIO } from "../runtime/platform-io.js";
|
|
8
|
+
export type MediaChecksum = {
|
|
9
|
+
source: "audio-payload" | "file";
|
|
10
|
+
algorithm: "sha256";
|
|
11
|
+
hex: string;
|
|
12
|
+
bytesHashed: number;
|
|
13
|
+
} | {
|
|
14
|
+
source: "flac-streaminfo-md5";
|
|
15
|
+
algorithm: "md5";
|
|
16
|
+
hex: string;
|
|
17
|
+
bytesHashed: 16;
|
|
18
|
+
};
|
|
19
|
+
export interface MediaChecksumOptions {
|
|
20
|
+
basis?: "encoded" | "pcm";
|
|
21
|
+
}
|
|
22
|
+
/** The literal a checksum's `source` field carries, so a consumer can hold one
|
|
23
|
+
* without restating the values. */
|
|
24
|
+
export type ChecksumSource = MediaChecksum["source"];
|
|
25
|
+
/** The algorithm any returned checksum can carry — narrowed by `source`. */
|
|
26
|
+
export type ChecksumAlgorithm = MediaChecksum["algorithm"];
|
|
27
|
+
/**
|
|
28
|
+
* What the checksum needs from the open handle — module-internal, and not
|
|
29
|
+
* re-exported from either entry point (`ChecksumSource` above is the public name,
|
|
30
|
+
* and a handle descriptor must not shadow it).
|
|
31
|
+
*/
|
|
32
|
+
interface ChecksumHandleSource {
|
|
33
|
+
/** The bytes the handle holds — a full file, a partial-load window image, or
|
|
34
|
+
* nothing at all when the data lives on disk (WASI path mode). */
|
|
35
|
+
bytes: Uint8Array;
|
|
36
|
+
/** The path, when the handle was opened from one. */
|
|
37
|
+
path?: string;
|
|
38
|
+
/** The File/Blob, when the handle was opened from one. */
|
|
39
|
+
blob?: Blob;
|
|
40
|
+
/** True when `bytes` is a spliced header+footer image rather than the file.
|
|
41
|
+
* Must be captured when the handle is created: `saveToFile()` clears the
|
|
42
|
+
* instance's own flag while the bytes stay spliced. */
|
|
43
|
+
partiallyLoaded: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare function mediaChecksum(source: ChecksumHandleSource, format: string, io: PlatformIO, options?: MediaChecksumOptions): Promise<MediaChecksum>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=audio-file-checksum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;IACE,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,SAAS,EAAE,QAAQ,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB,GACD;IACE,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,EAAE,KAAK,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,EAAE,CAAC;CACjB,CAAC;AAEN,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,CAgExB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { MetadataError, UnsupportedFormatError } from "../errors/classes.js";
|
|
2
|
+
import "../errors.js";
|
|
3
|
+
import { flacStreamInfoMd5, mediaRanges } from "./media-ranges.js";
|
|
4
|
+
//#region src/taglib/audio-file-checksum.ts
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview `mediaChecksum()`: a SHA-256 of a file's *encoded media
|
|
7
|
+
* payload* — the bytes that are the audio, and not the tags around them — plus
|
|
8
|
+
* FLAC's STREAMINFO digest passthrough. Factored out of `AudioFileImpl` so the
|
|
9
|
+
* source rule below (what actually gets hashed) is stated exactly once.
|
|
10
|
+
*/
|
|
11
|
+
/** The header window a path-mode handle reads for `basis: "pcm"`: STREAMINFO is
|
|
12
|
+
* a FLAC file's first metadata block, so nothing else in a 16-byte digest's
|
|
13
|
+
* worth of work needs reading — unless the tag in front of it is larger than
|
|
14
|
+
* this, which is why a window without a digest falls back to the whole file. */
|
|
15
|
+
const STREAMINFO_WINDOW = 65536;
|
|
16
|
+
/**
|
|
17
|
+
* The file's bytes — the checksum describes the file at its source, so the
|
|
18
|
+
* source wins over whatever the handle holds in memory:
|
|
19
|
+
*
|
|
20
|
+
* 1. a path is read (WASI path mode keeps nothing in memory, and a partial handle
|
|
21
|
+
* holds a spliced header+footer image, not the file);
|
|
22
|
+
* 2. a Blob/File is read (a partial File has no path — this is the only way back);
|
|
23
|
+
* 3. the caller's own bytes are used only when the handle could not have spliced
|
|
24
|
+
* them, i.e. no path, no blob, and not partial (Uint8Array/ArrayBuffer inputs
|
|
25
|
+
* have no partial mode by construction);
|
|
26
|
+
* 4. otherwise throw. That last case is real: saving a *partial* File handle drops
|
|
27
|
+
* both its original source and its partial flag (`audio-file-impl.ts:155-156`)
|
|
28
|
+
* while the in-memory bytes stay a spliced image — returning them would hash a
|
|
29
|
+
* truncated file and label it source: "audio-payload".
|
|
30
|
+
*
|
|
31
|
+
* The read is whole-file on purpose: ranges cannot be derived from a spliced
|
|
32
|
+
* image (the MPEG and MP4 walks need every frame and atom), and the digest needs
|
|
33
|
+
* the payload anyway — so the only extra bytes are the container's tag regions.
|
|
34
|
+
*/
|
|
35
|
+
async function fileBytes(source, io) {
|
|
36
|
+
if (source.path) return await io.readFile(source.path);
|
|
37
|
+
if (source.blob) return new Uint8Array(await source.blob.arrayBuffer());
|
|
38
|
+
if (!source.partiallyLoaded && source.bytes.length > 0) return source.bytes;
|
|
39
|
+
throw new MetadataError("read", "the handle holds no file bytes and has no readable source; a partial handle that has been saved drops its source — checksum the saved path instead");
|
|
40
|
+
}
|
|
41
|
+
/** Web Crypto has no streaming digest, so the payload is materialized once —
|
|
42
|
+
* bounded by the payload the caller asked us to hash. The return is annotated
|
|
43
|
+
* because digest() takes a `BufferSource` and a bare `Uint8Array` widens to
|
|
44
|
+
* ArrayBufferLike (shared buffers are not a BufferSource). */
|
|
45
|
+
function joinRanges(bytes, ranges) {
|
|
46
|
+
const total = ranges.reduce((n, r) => n + r.length, 0);
|
|
47
|
+
const overrun = ranges.find((r) => r.offset + r.length > bytes.length);
|
|
48
|
+
if (overrun || total > bytes.length) throw new MetadataError("read", `range walk overran the buffer (${overrun ? `range ${overrun.offset}+${overrun.length}` : `${total} bytes`} past the ${bytes.length}-byte buffer)`);
|
|
49
|
+
if (ranges.length === 1) {
|
|
50
|
+
const only = ranges[0];
|
|
51
|
+
const view = bytes.subarray(only.offset, only.offset + only.length);
|
|
52
|
+
return view.buffer instanceof ArrayBuffer ? view : new Uint8Array(view);
|
|
53
|
+
}
|
|
54
|
+
const out = new Uint8Array(total);
|
|
55
|
+
let at = 0;
|
|
56
|
+
for (const r of ranges) {
|
|
57
|
+
out.set(bytes.subarray(r.offset, r.offset + r.length), at);
|
|
58
|
+
at += r.length;
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
async function mediaChecksum(source, format, io, options = {}) {
|
|
63
|
+
if (options.basis === "pcm") {
|
|
64
|
+
if (format.toUpperCase() !== "FLAC") throw new UnsupportedFormatError(format, ["FLAC"], { operation: "media checksum (basis: pcm)" });
|
|
65
|
+
const windowed = source.bytes.length > 0 ? source.bytes : source.path && io.readPartial ? await io.readPartial(source.path, STREAMINFO_WINDOW, 0) : void 0;
|
|
66
|
+
let md5 = windowed === void 0 ? void 0 : flacStreamInfoMd5(windowed);
|
|
67
|
+
if (md5 === void 0 && windowed !== source.bytes) md5 = flacStreamInfoMd5(await fileBytes(source, io));
|
|
68
|
+
if (md5 === void 0) throw new MetadataError("read", "STREAMINFO digest unavailable");
|
|
69
|
+
return {
|
|
70
|
+
source: "flac-streaminfo-md5",
|
|
71
|
+
algorithm: "md5",
|
|
72
|
+
hex: md5,
|
|
73
|
+
bytesHashed: 16
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const bytes = await fileBytes(source, io);
|
|
77
|
+
const walk = mediaRanges(format, bytes);
|
|
78
|
+
const payload = joinRanges(bytes, walk.ranges);
|
|
79
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", payload));
|
|
80
|
+
let hex = "";
|
|
81
|
+
for (const byte of digest) hex += byte.toString(16).padStart(2, "0");
|
|
82
|
+
return {
|
|
83
|
+
source: walk.kind === "ranges" ? "audio-payload" : "file",
|
|
84
|
+
algorithm: "sha256",
|
|
85
|
+
hex,
|
|
86
|
+
bytesHashed: payload.length
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { mediaChecksum };
|
|
@@ -6,6 +6,7 @@ import type { Id3v2Frame, Rating, UnsyncedLyrics } from "../constants/complex-pr
|
|
|
6
6
|
import { type NormalizedRating } from "../utils/rating.js";
|
|
7
7
|
import type { AudioFile } from "./audio-file-interface.js";
|
|
8
8
|
import { BaseAudioFileImpl } from "./audio-file-base.js";
|
|
9
|
+
import { type MediaChecksum, type MediaChecksumOptions } from "./audio-file-checksum.js";
|
|
9
10
|
/** @internal Exported for unit tests (tests/node-fs-acquisition.test.ts). */
|
|
10
11
|
export declare function readFileSync(path: string): Uint8Array;
|
|
11
12
|
/**
|
|
@@ -16,9 +17,12 @@ export declare function readFileSync(path: string): Uint8Array;
|
|
|
16
17
|
*/
|
|
17
18
|
export declare class AudioFileImpl extends BaseAudioFileImpl implements AudioFile {
|
|
18
19
|
private pathModeBuffer;
|
|
20
|
+
/** How the handle was loaded — `isPartiallyLoaded` is mutated by saveToFile(). */
|
|
21
|
+
private readonly partiallyLoadedAtConstruction;
|
|
19
22
|
constructor(module: TagLibModule, fileHandle: WasmFileHandle, sourcePath?: string, originalSource?: string | Uint8Array | ArrayBuffer | File, isPartiallyLoaded?: boolean, partialLoadOptions?: OpenOptions);
|
|
20
23
|
save(): boolean;
|
|
21
24
|
getFileBuffer(): Uint8Array;
|
|
25
|
+
mediaChecksum(options?: MediaChecksumOptions): Promise<MediaChecksum>;
|
|
22
26
|
saveToFile(path?: string): Promise<void>;
|
|
23
27
|
getPictures(): Picture[];
|
|
24
28
|
setPictures(pictures: Picture[]): void;
|
|
@@ -0,0 +1 @@
|
|
|
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;IA6D9C,WAAW,IAAI,OAAO,EAAE;IAYxB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAWtC,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;IAUnC,SAAS,IAAI,cAAc,EAAE;IAS7B,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI;IAUzC,SAAS,IAAI,gBAAgB,GAAG,SAAS;IAKzC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAU/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"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES } from "../types/pictures.js";
|
|
2
|
+
import "../types.js";
|
|
3
|
+
import { FileOperationError, UnsupportedFormatError, errorMessage } from "../errors/classes.js";
|
|
4
|
+
import "../errors.js";
|
|
5
|
+
import { getBext, getBextData, getIxml, setBext, setBextData, setIxml } from "./audio-file-bwf.js";
|
|
6
|
+
import { assertFrameBodies, assertFrameId, assertMp3, toPublicFrame } from "./id3v2-frames.js";
|
|
7
|
+
import { isDeno } from "../runtime/detector.js";
|
|
8
|
+
import { getPlatformIO } from "../runtime/platform-io.js";
|
|
9
|
+
import { writeFileData } from "../utils/write.js";
|
|
10
|
+
import { getNodeFsSync } from "../utils/node-fs.js";
|
|
11
|
+
import { normalized } from "../utils/rating.js";
|
|
12
|
+
import _defineProperty from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js";
|
|
13
|
+
import { BaseAudioFileImpl } from "./audio-file-base.js";
|
|
14
|
+
import { mediaChecksum } from "./audio-file-checksum.js";
|
|
15
|
+
import { saveViaFreshHandle } from "./save-reconstruct.js";
|
|
16
|
+
//#region src/taglib/audio-file-impl.ts
|
|
17
|
+
function sortChapters(list) {
|
|
18
|
+
return [...list].sort((a, b) => a.startTimeMs - b.startTimeMs);
|
|
19
|
+
}
|
|
20
|
+
function inferEndTimeMs(sorted, index, trackEndMs) {
|
|
21
|
+
const own = sorted[index].endTimeMs;
|
|
22
|
+
if (own !== void 0) return own;
|
|
23
|
+
const next = sorted[index + 1];
|
|
24
|
+
return next ? next.startTimeMs : trackEndMs;
|
|
25
|
+
}
|
|
26
|
+
/** @internal Exported for unit tests (tests/node-fs-acquisition.test.ts). */
|
|
27
|
+
function readFileSync(path) {
|
|
28
|
+
if (isDeno()) return Deno.readFileSync(path);
|
|
29
|
+
const fs = getNodeFsSync();
|
|
30
|
+
if (fs) return new Uint8Array(fs.readFileSync(path));
|
|
31
|
+
throw new FileOperationError("read", "node:fs is unavailable in this runtime: cannot read file data from disk", path);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Implementation of AudioFile interface using Embind API.
|
|
35
|
+
*
|
|
36
|
+
* @internal This class is not meant to be instantiated directly.
|
|
37
|
+
* Use TagLib.open() to create instances.
|
|
38
|
+
*/
|
|
39
|
+
var AudioFileImpl = class extends BaseAudioFileImpl {
|
|
40
|
+
constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
|
|
41
|
+
super(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded, partialLoadOptions);
|
|
42
|
+
_defineProperty(this, "pathModeBuffer", null);
|
|
43
|
+
_defineProperty(this, "partiallyLoadedAtConstruction", void 0);
|
|
44
|
+
this.partiallyLoadedAtConstruction = isPartiallyLoaded;
|
|
45
|
+
}
|
|
46
|
+
save() {
|
|
47
|
+
if (this.isPartiallyLoaded && this.originalSource) throw new FileOperationError("save", "Cannot save partially loaded file directly. Use saveToFile() instead");
|
|
48
|
+
this.cachedAudioProperties = null;
|
|
49
|
+
this.pathModeBuffer = null;
|
|
50
|
+
return this.handle.save();
|
|
51
|
+
}
|
|
52
|
+
getFileBuffer() {
|
|
53
|
+
const buffer = this.handle.getBuffer();
|
|
54
|
+
if (buffer.length > 0) return buffer;
|
|
55
|
+
if (this.pathModeBuffer) return this.pathModeBuffer;
|
|
56
|
+
if (this.sourcePath) try {
|
|
57
|
+
this.pathModeBuffer = readFileSync(this.sourcePath);
|
|
58
|
+
return this.pathModeBuffer;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (error instanceof FileOperationError) throw error;
|
|
61
|
+
throw new FileOperationError("read", `Cannot return file data: ${errorMessage(error)}`, this.sourcePath, { cause: error });
|
|
62
|
+
}
|
|
63
|
+
throw new FileOperationError("read", "No file data available: in-memory buffer is empty and no source path is set");
|
|
64
|
+
}
|
|
65
|
+
mediaChecksum(options) {
|
|
66
|
+
return mediaChecksum({
|
|
67
|
+
bytes: this.handle.getBuffer(),
|
|
68
|
+
...this.sourcePath !== void 0 ? { path: this.sourcePath } : {},
|
|
69
|
+
...this.originalSource instanceof Blob ? { blob: this.originalSource } : {},
|
|
70
|
+
partiallyLoaded: this.partiallyLoadedAtConstruction
|
|
71
|
+
}, this.getFormat(), getPlatformIO(), options);
|
|
72
|
+
}
|
|
73
|
+
async saveToFile(path) {
|
|
74
|
+
const targetPath = path ?? this.sourcePath;
|
|
75
|
+
if (!targetPath) throw new FileOperationError("save", "No file path available. Provide a path or open the file from a path");
|
|
76
|
+
if (this.isPartiallyLoaded && this.originalSource) {
|
|
77
|
+
await saveViaFreshHandle(this.module, this.handle, this.originalSource, targetPath, false, this.partialDeletedPropertyKeys());
|
|
78
|
+
this.isPartiallyLoaded = false;
|
|
79
|
+
this.originalSource = void 0;
|
|
80
|
+
} else if (this.module.isWasi && this.sourcePath && targetPath !== this.sourcePath) await saveViaFreshHandle(this.module, this.handle, this.sourcePath, targetPath, true);
|
|
81
|
+
else {
|
|
82
|
+
if (!this.save()) throw new FileOperationError("save", "Failed to save changes to in-memory buffer");
|
|
83
|
+
const buffer = this.handle.getBuffer();
|
|
84
|
+
if (buffer.length > 0) await writeFileData(targetPath, buffer);
|
|
85
|
+
}
|
|
86
|
+
this.pathModeBuffer = null;
|
|
87
|
+
}
|
|
88
|
+
getPictures() {
|
|
89
|
+
return this.handle.getPictures().map((pic) => ({
|
|
90
|
+
mimeType: pic.mimeType,
|
|
91
|
+
data: pic.data,
|
|
92
|
+
type: PICTURE_TYPE_NAMES[pic.type] ?? "Other",
|
|
93
|
+
...pic.description !== void 0 ? { description: pic.description } : {}
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
setPictures(pictures) {
|
|
97
|
+
this.handle.setPictures(pictures.map((pic) => ({
|
|
98
|
+
mimeType: pic.mimeType,
|
|
99
|
+
data: pic.data,
|
|
100
|
+
type: PICTURE_TYPE_VALUES[pic.type] ?? 0,
|
|
101
|
+
description: pic.description ?? ""
|
|
102
|
+
})));
|
|
103
|
+
}
|
|
104
|
+
addPicture(picture) {
|
|
105
|
+
this.handle.addPicture({
|
|
106
|
+
mimeType: picture.mimeType,
|
|
107
|
+
data: picture.data,
|
|
108
|
+
type: PICTURE_TYPE_VALUES[picture.type] ?? 0,
|
|
109
|
+
description: picture.description ?? ""
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
removePictures() {
|
|
113
|
+
this.handle.removePictures();
|
|
114
|
+
}
|
|
115
|
+
getChapters() {
|
|
116
|
+
const sorted = sortChapters(this.handle.getChapters());
|
|
117
|
+
const trackEndMs = this.audioProperties()?.durationMs;
|
|
118
|
+
return sorted.map((c, i) => {
|
|
119
|
+
const endTimeMs = inferEndTimeMs(sorted, i, trackEndMs);
|
|
120
|
+
return {
|
|
121
|
+
startTimeMs: c.startTimeMs,
|
|
122
|
+
...endTimeMs !== void 0 ? { endTimeMs } : {},
|
|
123
|
+
...c.title ? { title: c.title } : {},
|
|
124
|
+
...c.id ? { id: c.id } : {},
|
|
125
|
+
...c.source !== void 0 ? { source: c.source } : {}
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
setChapters(chapters, options) {
|
|
130
|
+
const fmt = this.getFormat();
|
|
131
|
+
if (fmt !== "MP3" && fmt !== "AAC" && fmt !== "MP4") throw new UnsupportedFormatError(fmt, [
|
|
132
|
+
"MP3",
|
|
133
|
+
"AAC",
|
|
134
|
+
"MP4"
|
|
135
|
+
], { operation: "setChapters" });
|
|
136
|
+
const sorted = sortChapters(chapters);
|
|
137
|
+
const trackEndMs = this.audioProperties()?.durationMs;
|
|
138
|
+
const style = options?.mp4ChapterStyle ?? "quicktime";
|
|
139
|
+
const source = fmt === "MP4" ? style : "id3";
|
|
140
|
+
const raw = sorted.map((c, i) => ({
|
|
141
|
+
...c.id !== void 0 ? { id: c.id } : {},
|
|
142
|
+
startTimeMs: c.startTimeMs,
|
|
143
|
+
endTimeMs: inferEndTimeMs(sorted, i, trackEndMs) ?? c.startTimeMs,
|
|
144
|
+
...c.title !== void 0 ? { title: c.title } : {},
|
|
145
|
+
source
|
|
146
|
+
}));
|
|
147
|
+
this.handle.setChapters(raw, style);
|
|
148
|
+
}
|
|
149
|
+
getBext() {
|
|
150
|
+
return getBext(this.handle);
|
|
151
|
+
}
|
|
152
|
+
setBext(bext) {
|
|
153
|
+
setBext(this.handle, this.getFormat(), bext);
|
|
154
|
+
}
|
|
155
|
+
getBextData() {
|
|
156
|
+
return getBextData(this.handle);
|
|
157
|
+
}
|
|
158
|
+
setBextData(data) {
|
|
159
|
+
setBextData(this.handle, this.getFormat(), data);
|
|
160
|
+
}
|
|
161
|
+
getIxml() {
|
|
162
|
+
return getIxml(this.handle);
|
|
163
|
+
}
|
|
164
|
+
setIxml(data) {
|
|
165
|
+
setIxml(this.handle, this.getFormat(), data);
|
|
166
|
+
}
|
|
167
|
+
getRatings() {
|
|
168
|
+
return this.handle.getRatings().map((r) => ({
|
|
169
|
+
rating: r.rating,
|
|
170
|
+
...r.email !== void 0 && r.email !== "" ? { email: r.email } : {},
|
|
171
|
+
...r.counter !== 0 ? { counter: r.counter } : {}
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
setRatings(ratings) {
|
|
175
|
+
this.handle.setRatings(ratings.map((r) => ({
|
|
176
|
+
rating: r.rating,
|
|
177
|
+
email: r.email ?? "",
|
|
178
|
+
counter: r.counter ?? 0
|
|
179
|
+
})));
|
|
180
|
+
}
|
|
181
|
+
getLyrics() {
|
|
182
|
+
return this.handle.getLyrics().map((l) => {
|
|
183
|
+
const out = { text: l.text };
|
|
184
|
+
if (l.description) out.description = l.description;
|
|
185
|
+
if (l.language) out.language = l.language;
|
|
186
|
+
return out;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
setLyrics(lyrics) {
|
|
190
|
+
this.handle.setLyrics(lyrics.map((l) => ({
|
|
191
|
+
text: l.text,
|
|
192
|
+
description: l.description ?? "",
|
|
193
|
+
language: l.language ?? ""
|
|
194
|
+
})));
|
|
195
|
+
}
|
|
196
|
+
getRating() {
|
|
197
|
+
const ratings = this.getRatings();
|
|
198
|
+
return ratings.length > 0 ? normalized(ratings[0].rating) : void 0;
|
|
199
|
+
}
|
|
200
|
+
setRating(rating, email) {
|
|
201
|
+
this.setRatings([{
|
|
202
|
+
rating,
|
|
203
|
+
...email !== void 0 ? { email } : {},
|
|
204
|
+
counter: 0
|
|
205
|
+
}]);
|
|
206
|
+
}
|
|
207
|
+
getId3v2Frames(id) {
|
|
208
|
+
assertMp3(this.getFormat());
|
|
209
|
+
if (id !== void 0) assertFrameId(id, "read");
|
|
210
|
+
return this.handle.getId3v2Frames(id ?? "").map(toPublicFrame);
|
|
211
|
+
}
|
|
212
|
+
setId3v2Frames(id, data) {
|
|
213
|
+
assertMp3(this.getFormat());
|
|
214
|
+
assertFrameId(id, "write");
|
|
215
|
+
assertFrameBodies(id, data);
|
|
216
|
+
this.handle.setId3v2Frames(id, data);
|
|
217
|
+
}
|
|
218
|
+
removeId3v2Frames(id) {
|
|
219
|
+
assertMp3(this.getFormat());
|
|
220
|
+
assertFrameId(id, "write");
|
|
221
|
+
this.handle.removeId3v2Frames(id);
|
|
222
|
+
}
|
|
223
|
+
hasId3Tags() {
|
|
224
|
+
return this.handle.hasId3Tags();
|
|
225
|
+
}
|
|
226
|
+
stripId3Tags(opts) {
|
|
227
|
+
this.handle.stripId3Tags({
|
|
228
|
+
v1: opts?.v1 ?? true,
|
|
229
|
+
v2: opts?.v2 ?? true
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
//#endregion
|
|
234
|
+
export { AudioFileImpl, readFileSync };
|