audio-decode 2.1.2 → 2.1.4
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/audio-decode.js +1 -1
- package/package.json +7 -6
- package/test.js +5 -1
- package/test.mp3 +0 -0
package/audio-decode.js
CHANGED
|
@@ -9,7 +9,7 @@ import AudioBufferShim from 'audio-buffer';
|
|
|
9
9
|
const AudioBuffer = globalThis.AudioBuffer || AudioBufferShim
|
|
10
10
|
|
|
11
11
|
export default async function audioDecode (buf) {
|
|
12
|
-
if (!buf) throw Error('
|
|
12
|
+
if (!buf && !(buf.length || buf.buffer)) throw Error('Bad decode target')
|
|
13
13
|
buf = new Uint8Array(buf.buffer || buf)
|
|
14
14
|
|
|
15
15
|
let type = getType(buf);
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "audio-decode",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Decode audio data in node or browser",
|
|
5
5
|
"main": "audio-decode.js",
|
|
6
|
+
"module": "audio-decode.js",
|
|
7
|
+
"browser": "audio-decode.js",
|
|
6
8
|
"type": "module",
|
|
7
9
|
"dependencies": {
|
|
8
|
-
"@wasm-audio-decoders/flac": "^0.1.
|
|
9
|
-
"@wasm-audio-decoders/ogg-vorbis": "^0.1.
|
|
10
|
+
"@wasm-audio-decoders/flac": "^0.1.12",
|
|
11
|
+
"@wasm-audio-decoders/ogg-vorbis": "^0.1.7",
|
|
10
12
|
"audio-buffer": "^5.0.0",
|
|
11
13
|
"audio-type": "^2.2.0",
|
|
12
|
-
"mpg123-decoder": "^0.4.
|
|
14
|
+
"mpg123-decoder": "^0.4.8",
|
|
13
15
|
"node-wav": "^0.0.2",
|
|
14
|
-
"ogg-opus-decoder": "^1.
|
|
16
|
+
"ogg-opus-decoder": "^1.6.4",
|
|
15
17
|
"qoa-format": "^1.0.0"
|
|
16
18
|
},
|
|
17
19
|
"devDependencies": {
|
|
@@ -19,7 +21,6 @@
|
|
|
19
21
|
"base64-arraybuffer": "^1.0.2",
|
|
20
22
|
"tst": "^7.1.1"
|
|
21
23
|
},
|
|
22
|
-
"browser": "./browser.js",
|
|
23
24
|
"scripts": {
|
|
24
25
|
"test": "node test.js"
|
|
25
26
|
},
|
package/test.js
CHANGED
|
@@ -91,5 +91,9 @@ t('malformed data', async t => {
|
|
|
91
91
|
let x = await decodeAudio(null)
|
|
92
92
|
} catch (e) { log.push('null')}
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
try {
|
|
95
|
+
let x = await decodeAudio(Promise.resolve())
|
|
96
|
+
} catch (e) { log.push('nonbuf')}
|
|
97
|
+
|
|
98
|
+
is(log, ['arr', 'null', 'nonbuf'])
|
|
95
99
|
})
|
package/test.mp3
DELETED
|
Binary file
|