taglib-wasm 0.3.13 → 0.3.15
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/README.md +22 -35
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +117 -134
- package/dist/index.js.map +1 -0
- package/dist/src/constants.js +211 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/errors.js +180 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/file-utils.d.ts +2 -2
- package/dist/src/file-utils.d.ts.map +1 -1
- package/dist/src/file-utils.js +394 -0
- package/dist/src/file-utils.js.map +1 -0
- package/dist/src/mod.d.ts +4 -4
- package/dist/src/mod.d.ts.map +1 -1
- package/dist/src/mod.js +7 -0
- package/dist/src/mod.js.map +1 -0
- package/dist/src/simple.d.ts +4 -4
- package/dist/src/simple.d.ts.map +1 -1
- package/dist/src/{simple.ts → simple.js} +193 -311
- package/dist/src/simple.js.map +1 -0
- package/dist/src/taglib.d.ts +3 -3
- package/dist/src/taglib.d.ts.map +1 -1
- package/dist/src/taglib.js +516 -0
- package/dist/src/taglib.js.map +1 -0
- package/dist/src/types.d.ts +2 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +239 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/file.js +65 -0
- package/dist/src/utils/file.js.map +1 -0
- package/dist/src/utils/write.js +49 -0
- package/dist/src/utils/write.js.map +1 -0
- package/dist/src/wasm-workers.d.ts +1 -1
- package/dist/src/wasm-workers.d.ts.map +1 -1
- package/dist/src/wasm-workers.js +148 -0
- package/dist/src/wasm-workers.js.map +1 -0
- package/dist/src/wasm.js +6 -0
- package/dist/src/wasm.js.map +1 -0
- package/dist/src/web-utils.d.ts +2 -2
- package/dist/src/web-utils.d.ts.map +1 -1
- package/{src/web-utils.ts → dist/src/web-utils.js} +102 -184
- package/dist/src/web-utils.js.map +1 -0
- package/dist/src/workers.d.ts +2 -2
- package/dist/src/workers.d.ts.map +1 -1
- package/dist/src/workers.js +389 -0
- package/dist/src/workers.js.map +1 -0
- package/dist/taglib-wrapper.js +8 -2528
- package/package.json +7 -10
- package/dist/index.ts +0 -221
- package/dist/src/constants.ts +0 -227
- package/dist/src/errors.ts +0 -254
- package/dist/src/file-utils.ts +0 -483
- package/dist/src/file.js +0 -52
- package/dist/src/global.d.ts +0 -12
- package/dist/src/mod.ts +0 -19
- package/dist/src/taglib.ts +0 -961
- package/dist/src/types.ts +0 -538
- package/dist/src/utils/file.ts +0 -86
- package/dist/src/utils/write.ts +0 -66
- package/dist/src/wasm-workers.ts +0 -176
- package/dist/src/wasm.ts +0 -133
- package/dist/src/web-utils.ts +0 -347
- package/dist/src/workers.ts +0 -461
- package/dist/src/write.js +0 -33
- package/index.ts +0 -221
- package/lib/taglib/COPYING.LGPL +0 -502
- package/lib/taglib/COPYING.MPL +0 -470
- package/lib/taglib/README.md +0 -24
- package/src/constants.ts +0 -227
- package/src/errors.ts +0 -254
- package/src/file-utils.ts +0 -483
- package/src/global.d.ts +0 -12
- package/src/mod.ts +0 -19
- package/src/simple.ts +0 -667
- package/src/taglib.ts +0 -961
- package/src/types.ts +0 -538
- package/src/utils/file.ts +0 -86
- package/src/utils/write.ts +0 -66
- package/src/wasm-workers.ts +0 -176
- package/src/wasm.ts +0 -133
- package/src/workers.ts +0 -461
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Cloudflare Workers-specific TagLib API
|
|
3
|
+
*
|
|
4
|
+
* This module provides a specialized API for using TagLib in Cloudflare Workers
|
|
5
|
+
* and other edge computing environments where the standard Emscripten module
|
|
6
|
+
* loading may not work. It uses C-style function exports for compatibility.
|
|
7
|
+
*
|
|
8
|
+
* @module taglib-wasm/workers
|
|
9
|
+
*/
|
|
10
|
+
import { cStringToJS, jsToCString, loadTagLibModuleForWorkers, } from "./wasm-workers.js";
|
|
11
|
+
import { EnvironmentError, InvalidFormatError, MemoryError } from "./errors.js";
|
|
12
|
+
/**
|
|
13
|
+
* Represents an audio file with metadata and properties (Workers-compatible).
|
|
14
|
+
* This implementation uses C-style function calls for Cloudflare Workers compatibility.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const file = taglib.openFile(audioBuffer);
|
|
19
|
+
*
|
|
20
|
+
* // Get metadata
|
|
21
|
+
* const tag = file.tag();
|
|
22
|
+
* console.log(tag.title);
|
|
23
|
+
*
|
|
24
|
+
* // Modify metadata
|
|
25
|
+
* file.setTitle("New Title");
|
|
26
|
+
* file.save();
|
|
27
|
+
*
|
|
28
|
+
* // Clean up
|
|
29
|
+
* file.dispose();
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export class AudioFileWorkers {
|
|
33
|
+
constructor(module, fileId) {
|
|
34
|
+
this.module = module;
|
|
35
|
+
this.fileId = fileId;
|
|
36
|
+
this.tagPtr = module._taglib_file_tag?.(fileId) || 0;
|
|
37
|
+
this.propsPtr = module._taglib_file_audioproperties?.(fileId) || 0;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if the file is valid and was loaded successfully.
|
|
41
|
+
* @returns true if the file is valid and can be processed
|
|
42
|
+
*/
|
|
43
|
+
isValid() {
|
|
44
|
+
return this.module._taglib_file_is_valid?.(this.fileId) !== 0;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get the file format.
|
|
48
|
+
* @returns Audio format (e.g., "MP3", "FLAC", "OGG")
|
|
49
|
+
*/
|
|
50
|
+
format() {
|
|
51
|
+
const formatPtr = this.module._taglib_file_format?.(this.fileId) || 0;
|
|
52
|
+
if (formatPtr === 0)
|
|
53
|
+
return "MP3"; // fallback
|
|
54
|
+
const formatStr = cStringToJS(this.module, formatPtr);
|
|
55
|
+
return formatStr;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get basic tag information.
|
|
59
|
+
* @returns Object containing title, artist, album, etc.
|
|
60
|
+
*/
|
|
61
|
+
tag() {
|
|
62
|
+
if (this.tagPtr === 0)
|
|
63
|
+
return {};
|
|
64
|
+
const title = this.module._taglib_tag_title?.(this.tagPtr) || 0;
|
|
65
|
+
const artist = this.module._taglib_tag_artist?.(this.tagPtr) || 0;
|
|
66
|
+
const album = this.module._taglib_tag_album?.(this.tagPtr) || 0;
|
|
67
|
+
const comment = this.module._taglib_tag_comment?.(this.tagPtr) || 0;
|
|
68
|
+
const genre = this.module._taglib_tag_genre?.(this.tagPtr) || 0;
|
|
69
|
+
const year = this.module._taglib_tag_year?.(this.tagPtr) || 0;
|
|
70
|
+
const track = this.module._taglib_tag_track?.(this.tagPtr) || 0;
|
|
71
|
+
return {
|
|
72
|
+
title: title ? cStringToJS(this.module, title) : undefined,
|
|
73
|
+
artist: artist ? cStringToJS(this.module, artist) : undefined,
|
|
74
|
+
album: album ? cStringToJS(this.module, album) : undefined,
|
|
75
|
+
comment: comment ? cStringToJS(this.module, comment) : undefined,
|
|
76
|
+
genre: genre ? cStringToJS(this.module, genre) : undefined,
|
|
77
|
+
year: year || undefined,
|
|
78
|
+
track: track || undefined,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get audio properties (duration, bitrate, etc.).
|
|
83
|
+
* @returns Audio properties or null if unavailable
|
|
84
|
+
*/
|
|
85
|
+
audioProperties() {
|
|
86
|
+
if (this.propsPtr === 0)
|
|
87
|
+
return null;
|
|
88
|
+
const length = this.module._taglib_audioproperties_length?.(this.propsPtr) || 0;
|
|
89
|
+
const bitrate = this.module._taglib_audioproperties_bitrate?.(this.propsPtr) || 0;
|
|
90
|
+
const sampleRate = this.module._taglib_audioproperties_samplerate?.(this.propsPtr) || 0;
|
|
91
|
+
const channels = this.module._taglib_audioproperties_channels?.(this.propsPtr) || 0;
|
|
92
|
+
return {
|
|
93
|
+
length,
|
|
94
|
+
bitrate,
|
|
95
|
+
sampleRate,
|
|
96
|
+
channels,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Set the title tag.
|
|
101
|
+
* @param title - New title value
|
|
102
|
+
*/
|
|
103
|
+
setTitle(title) {
|
|
104
|
+
if (this.tagPtr === 0)
|
|
105
|
+
return;
|
|
106
|
+
const titlePtr = jsToCString(this.module, title);
|
|
107
|
+
this.module._taglib_tag_set_title?.(this.tagPtr, titlePtr);
|
|
108
|
+
this.module._free(titlePtr);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Set the artist tag.
|
|
112
|
+
* @param artist - New artist value
|
|
113
|
+
*/
|
|
114
|
+
setArtist(artist) {
|
|
115
|
+
if (this.tagPtr === 0)
|
|
116
|
+
return;
|
|
117
|
+
const artistPtr = jsToCString(this.module, artist);
|
|
118
|
+
this.module._taglib_tag_set_artist?.(this.tagPtr, artistPtr);
|
|
119
|
+
this.module._free(artistPtr);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Set the album tag.
|
|
123
|
+
* @param album - New album value
|
|
124
|
+
*/
|
|
125
|
+
setAlbum(album) {
|
|
126
|
+
if (this.tagPtr === 0)
|
|
127
|
+
return;
|
|
128
|
+
const albumPtr = jsToCString(this.module, album);
|
|
129
|
+
this.module._taglib_tag_set_album?.(this.tagPtr, albumPtr);
|
|
130
|
+
this.module._free(albumPtr);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Set the comment tag.
|
|
134
|
+
* @param comment - New comment value
|
|
135
|
+
*/
|
|
136
|
+
setComment(comment) {
|
|
137
|
+
if (this.tagPtr === 0)
|
|
138
|
+
return;
|
|
139
|
+
const commentPtr = jsToCString(this.module, comment);
|
|
140
|
+
this.module._taglib_tag_set_comment?.(this.tagPtr, commentPtr);
|
|
141
|
+
this.module._free(commentPtr);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Set the genre tag.
|
|
145
|
+
* @param genre - New genre value
|
|
146
|
+
*/
|
|
147
|
+
setGenre(genre) {
|
|
148
|
+
if (this.tagPtr === 0)
|
|
149
|
+
return;
|
|
150
|
+
const genrePtr = jsToCString(this.module, genre);
|
|
151
|
+
this.module._taglib_tag_set_genre?.(this.tagPtr, genrePtr);
|
|
152
|
+
this.module._free(genrePtr);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Set the year tag.
|
|
156
|
+
* @param year - Release year
|
|
157
|
+
*/
|
|
158
|
+
setYear(year) {
|
|
159
|
+
if (this.tagPtr === 0)
|
|
160
|
+
return;
|
|
161
|
+
this.module._taglib_tag_set_year?.(this.tagPtr, year);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Set the track number tag.
|
|
165
|
+
* @param track - Track number
|
|
166
|
+
*/
|
|
167
|
+
setTrack(track) {
|
|
168
|
+
if (this.tagPtr === 0)
|
|
169
|
+
return;
|
|
170
|
+
this.module._taglib_tag_set_track?.(this.tagPtr, track);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Save changes to the file.
|
|
174
|
+
* Note: In Workers context, this saves to the in-memory buffer only.
|
|
175
|
+
* @returns true if save was successful
|
|
176
|
+
*/
|
|
177
|
+
save() {
|
|
178
|
+
if (this.fileId !== 0) {
|
|
179
|
+
return this.module._taglib_file_save?.(this.fileId) !== 0;
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get the current file buffer after modifications.
|
|
185
|
+
* Note: This is not implemented in the Workers API.
|
|
186
|
+
* @returns Empty Uint8Array (not implemented)
|
|
187
|
+
* @deprecated Use the Core API for this functionality
|
|
188
|
+
*/
|
|
189
|
+
getFileBuffer() {
|
|
190
|
+
console.warn("getFileBuffer() is not implemented in Workers API. Use Core API for this functionality.");
|
|
191
|
+
return new Uint8Array(0);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get extended metadata with format-agnostic field names.
|
|
195
|
+
* Note: Currently returns only basic fields in Workers API.
|
|
196
|
+
* @returns Extended tag object with basic fields populated
|
|
197
|
+
*/
|
|
198
|
+
extendedTag() {
|
|
199
|
+
const basicTag = this.tag();
|
|
200
|
+
return {
|
|
201
|
+
...basicTag,
|
|
202
|
+
// Advanced fields placeholder - would be populated by PropertyMap reading
|
|
203
|
+
acoustidFingerprint: undefined,
|
|
204
|
+
acoustidId: undefined,
|
|
205
|
+
musicbrainzTrackId: undefined,
|
|
206
|
+
musicbrainzReleaseId: undefined,
|
|
207
|
+
musicbrainzArtistId: undefined,
|
|
208
|
+
musicbrainzReleaseGroupId: undefined,
|
|
209
|
+
albumArtist: undefined,
|
|
210
|
+
composer: undefined,
|
|
211
|
+
discNumber: undefined,
|
|
212
|
+
totalTracks: undefined,
|
|
213
|
+
totalDiscs: undefined,
|
|
214
|
+
bpm: undefined,
|
|
215
|
+
compilation: undefined,
|
|
216
|
+
titleSort: undefined,
|
|
217
|
+
artistSort: undefined,
|
|
218
|
+
albumSort: undefined,
|
|
219
|
+
replayGainTrackGain: undefined,
|
|
220
|
+
replayGainTrackPeak: undefined,
|
|
221
|
+
replayGainAlbumGain: undefined,
|
|
222
|
+
replayGainAlbumPeak: undefined,
|
|
223
|
+
appleSoundCheck: undefined,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Set extended metadata using format-agnostic field names.
|
|
228
|
+
* Note: Currently only supports basic fields in Workers API.
|
|
229
|
+
* @param tag - Partial extended tag object with fields to update
|
|
230
|
+
*/
|
|
231
|
+
setExtendedTag(tag) {
|
|
232
|
+
if (tag.title !== undefined)
|
|
233
|
+
this.setTitle(tag.title);
|
|
234
|
+
if (tag.artist !== undefined)
|
|
235
|
+
this.setArtist(tag.artist);
|
|
236
|
+
if (tag.album !== undefined)
|
|
237
|
+
this.setAlbum(tag.album);
|
|
238
|
+
if (tag.comment !== undefined)
|
|
239
|
+
this.setComment(tag.comment);
|
|
240
|
+
if (tag.genre !== undefined)
|
|
241
|
+
this.setGenre(tag.genre);
|
|
242
|
+
if (tag.year !== undefined)
|
|
243
|
+
this.setYear(tag.year);
|
|
244
|
+
if (tag.track !== undefined)
|
|
245
|
+
this.setTrack(tag.track);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Clean up resources.
|
|
249
|
+
* Always call this when done to prevent memory leaks.
|
|
250
|
+
*/
|
|
251
|
+
dispose() {
|
|
252
|
+
if (this.fileId !== 0) {
|
|
253
|
+
this.module._taglib_file_delete?.(this.fileId);
|
|
254
|
+
this.fileId = 0;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Main TagLib class for Cloudflare Workers.
|
|
260
|
+
* Provides methods to initialize the library and open audio files
|
|
261
|
+
* in edge computing environments.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* import wasmBinary from "../build/taglib.wasm.js";
|
|
266
|
+
*
|
|
267
|
+
* // Initialize TagLib
|
|
268
|
+
* const taglib = await TagLibWorkers.initialize(wasmBinary);
|
|
269
|
+
*
|
|
270
|
+
* // Process audio file
|
|
271
|
+
* const file = taglib.openFile(audioBuffer);
|
|
272
|
+
* const metadata = file.tag();
|
|
273
|
+
* file.dispose();
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
export class TagLibWorkers {
|
|
277
|
+
constructor(module) {
|
|
278
|
+
this.module = module;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Initialize TagLib for Workers with Wasm binary
|
|
282
|
+
*
|
|
283
|
+
* @param wasmBinary - The WebAssembly binary as Uint8Array
|
|
284
|
+
* @param config - Optional configuration for the Wasm module
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* // In a Cloudflare Worker
|
|
289
|
+
* import wasmBinary from "../build/taglib.wasm.js";
|
|
290
|
+
*
|
|
291
|
+
* const taglib = await TagLibWorkers.initialize(wasmBinary);
|
|
292
|
+
* const file = taglib.open(audioBuffer);
|
|
293
|
+
* const metadata = file.tag();
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
static async initialize(wasmBinary, config) {
|
|
297
|
+
const module = await loadTagLibModuleForWorkers(wasmBinary, config);
|
|
298
|
+
return new TagLibWorkers(module);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Open an audio file from a buffer.
|
|
302
|
+
*
|
|
303
|
+
* @param buffer - Audio file data as Uint8Array
|
|
304
|
+
* @returns AudioFileWorkers instance
|
|
305
|
+
* @throws {Error} If Wasm module is not initialized
|
|
306
|
+
* @throws {Error} If file format is invalid or unsupported
|
|
307
|
+
* @throws {Error} If Workers API C-style functions are not available
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* const audioData = new Uint8Array(await request.arrayBuffer());
|
|
312
|
+
* const file = taglib.open(audioData);
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
open(buffer) {
|
|
316
|
+
if (!this.module.HEAPU8) {
|
|
317
|
+
throw new MemoryError("Wasm module not properly initialized: missing HEAPU8. " +
|
|
318
|
+
"The module may not have loaded correctly in the Workers environment.");
|
|
319
|
+
}
|
|
320
|
+
// Use Emscripten's allocate function for proper memory management
|
|
321
|
+
let dataPtr;
|
|
322
|
+
if (this.module.allocate && this.module.ALLOC_NORMAL !== undefined) {
|
|
323
|
+
dataPtr = this.module.allocate(buffer, this.module.ALLOC_NORMAL);
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
dataPtr = this.module._malloc(buffer.length);
|
|
327
|
+
this.module.HEAPU8.set(buffer, dataPtr);
|
|
328
|
+
}
|
|
329
|
+
if (!this.module._taglib_file_new_from_buffer) {
|
|
330
|
+
throw new EnvironmentError("Workers", "requires C-style functions which are not available. Use the Core API instead for this environment", "C-style function exports");
|
|
331
|
+
}
|
|
332
|
+
const fileId = this.module._taglib_file_new_from_buffer(dataPtr, buffer.length);
|
|
333
|
+
if (fileId === 0) {
|
|
334
|
+
// Free the allocated memory since file creation failed
|
|
335
|
+
this.module._free(dataPtr);
|
|
336
|
+
throw new InvalidFormatError("Failed to open audio file. File format may be invalid or not supported", buffer.length);
|
|
337
|
+
}
|
|
338
|
+
// Free the temporary buffer copy (TagLib has made its own copy in ByteVector)
|
|
339
|
+
this.module._free(dataPtr);
|
|
340
|
+
return new AudioFileWorkers(this.module, fileId);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* @deprecated Use `open()` instead. This method will be removed in the next major version.
|
|
344
|
+
* Open an audio file from a buffer (backward compatibility).
|
|
345
|
+
* @param buffer Audio file data as Uint8Array
|
|
346
|
+
* @returns Audio file instance
|
|
347
|
+
*/
|
|
348
|
+
openFile(buffer) {
|
|
349
|
+
return this.open(buffer);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Get the underlying Wasm module for advanced usage.
|
|
353
|
+
* @returns The initialized TagLib Wasm module
|
|
354
|
+
*/
|
|
355
|
+
getModule() {
|
|
356
|
+
return this.module;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Utility function to process audio metadata in a Cloudflare Worker
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* export default {
|
|
365
|
+
* async fetch(request: Request): Promise<Response> {
|
|
366
|
+
* if (request.method === "POST") {
|
|
367
|
+
* const audioData = new Uint8Array(await request.arrayBuffer());
|
|
368
|
+
* const metadata = await processAudioMetadata(wasmBinary, audioData);
|
|
369
|
+
* return Response.json(metadata);
|
|
370
|
+
* }
|
|
371
|
+
* return new Response("Method not allowed", { status: 405 });
|
|
372
|
+
* }
|
|
373
|
+
* };
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
export async function processAudioMetadata(wasmBinary, audioData, config) {
|
|
377
|
+
const taglib = await TagLibWorkers.initialize(wasmBinary, config);
|
|
378
|
+
const file = taglib.open(audioData);
|
|
379
|
+
try {
|
|
380
|
+
const tag = file.tag();
|
|
381
|
+
const properties = file.audioProperties();
|
|
382
|
+
const format = file.format();
|
|
383
|
+
return { tag, properties, format };
|
|
384
|
+
}
|
|
385
|
+
finally {
|
|
386
|
+
file.dispose();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
//# sourceMappingURL=workers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workers.js","sourceRoot":"","sources":["../../src/workers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,EACL,WAAW,EACX,WAAW,EACX,0BAA0B,GAE3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,gBAAgB;IAM3B,YAAY,MAAoB,EAAE,MAAc;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,4BAA4B,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtE,IAAI,SAAS,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC,CAAC,WAAW;QAC9C,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,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