Skip to content

Commit c980ff3

Browse files
committed
fix: parameter type of decompress
1 parent 6c77b0c commit c980ff3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changeset/fast-tomatoes-travel.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sv443-network/userutils": major
3+
---
4+
5+
`decompress()` now uses the same values for the outputType parameter as `compress()`

lib/misc.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ export async function compress(input: string | ArrayBuffer, compressionFormat: C
121121
return outputType === "arrayBuffer" ? buf : ab2str(buf);
122122
}
123123

124-
/** Decompresses a previously compressed base64 string or ArrayBuffer, with the format passed by {@linkcode compressionFormat}, converted to a string */
125-
export async function decompress(input: string | ArrayBuffer, compressionFormat: CompressionFormat, outputType?: "string"): Promise<string>
124+
/** Decompresses a previously compressed base64 string or ArrayBuffer, with the format passed by {@linkcode compressionFormat}, converted to a base64 string */
125+
export async function decompress(input: string | ArrayBuffer, compressionFormat: CompressionFormat, outputType?: "base64"): Promise<string>
126126
/** Decompresses a previously compressed base64 string or ArrayBuffer, with the format passed by {@linkcode compressionFormat}, converted to an ArrayBuffer */
127127
export async function decompress(input: string | ArrayBuffer, compressionFormat: CompressionFormat, outputType: "arrayBuffer"): Promise<ArrayBuffer>
128-
/** Decompresses a previously compressed base64 string or ArrayBuffer, with the format passed by {@linkcode compressionFormat}, converted to a string or ArrayBuffer, depending on what {@linkcode outputType} is set to */
129-
export async function decompress(input: string | ArrayBuffer, compressionFormat: CompressionFormat, outputType: "string" | "arrayBuffer" = "string"): Promise<ArrayBuffer | string> {
128+
/** Decompresses a previously compressed base64 string or ArrayBuffer, with the format passed by {@linkcode compressionFormat}, converted to a base64 string or ArrayBuffer, depending on what {@linkcode outputType} is set to */
129+
export async function decompress(input: string | ArrayBuffer, compressionFormat: CompressionFormat, outputType: "base64" | "arrayBuffer" = "base64"): Promise<ArrayBuffer | string> {
130130
const byteArray = typeof input === "string" ? str2ab(input) : input;
131131
const decomp = new DecompressionStream(compressionFormat);
132132
const writer = decomp.writable.getWriter();

0 commit comments

Comments
 (0)