Skip to content

Commit a9c1c11

Browse files
committed
feat: lzham not implemented
1 parent 6f792fd commit a9c1c11

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"editor.codeActionsOnSave": {
33
"source.fixAll.eslint": "explicit"
44
},
5-
"editor.formatOnSave": true
5+
"editor.formatOnSave": true,
6+
"typescript.tsdk": "node_modules/typescript/lib"
67
}

src/bundle.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,21 @@ const decompressBuffer = (
280280
type: number,
281281
uncompressedSize?: number,
282282
): ArrayBuffer => {
283-
switch (type) {
284-
case CompressionType.NONE:
285-
return data;
283+
if (type === CompressionType.NONE) return data;
284+
285+
if (!uncompressedSize) throw new Error('Uncompressed size not provided');
286286

287+
switch (type) {
287288
case CompressionType.LZMA:
288-
if (!uncompressedSize) throw new Error('Uncompressed size not provided');
289289
return decompressLzmaWithSize(new Uint8Array(data), uncompressedSize);
290290

291291
case CompressionType.LZ4:
292292
case CompressionType.LZ4_HC:
293-
case CompressionType.LZHAM:
294-
if (!uncompressedSize) throw new Error('Uncompressed size not provided');
295293
return decompressLz4(new Uint8Array(data), uncompressedSize).buffer;
296294

295+
case CompressionType.LZHAM:
296+
throw new Error('Not implemented');
297+
297298
default:
298299
throw new Error(`Unsupported compression type: ${CompressionType[type] || type}`);
299300
}

yarn.lock

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,8 +2818,16 @@ string-argv@~0.3.2:
28182818
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6"
28192819
integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==
28202820

2821-
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
2822-
name string-width-cjs
2821+
"string-width-cjs@npm:string-width@^4.2.0":
2822+
version "4.2.3"
2823+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
2824+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
2825+
dependencies:
2826+
emoji-regex "^8.0.0"
2827+
is-fullwidth-code-point "^3.0.0"
2828+
strip-ansi "^6.0.1"
2829+
2830+
string-width@^4.1.0:
28232831
version "4.2.3"
28242832
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
28252833
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -2888,7 +2896,14 @@ string_decoder@~1.1.1:
28882896
dependencies:
28892897
safe-buffer "~5.1.0"
28902898

2891-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
2899+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
2900+
version "6.0.1"
2901+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
2902+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
2903+
dependencies:
2904+
ansi-regex "^5.0.1"
2905+
2906+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
28922907
version "6.0.1"
28932908
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
28942909
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==

0 commit comments

Comments
 (0)