-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix type changes on deflate function
- Loading branch information
Showing
3 changed files
with
8 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.vscode/ | ||
test*.zip | ||
test*.zip | ||
.gitconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import { deflateRaw, inflateRaw } from 'https://esm.sh/pako'; | ||
|
||
export function deflate(data:Uint8Array) { | ||
return deflateRaw(data) | ||
return deflateRaw(data) || new Uint8Array(); | ||
} | ||
|
||
export function inflate(data:Uint8Array) { | ||
return inflateRaw(data); | ||
const output = inflateRaw(data); | ||
if (!output) return new Uint8Array(); | ||
if (typeof output === 'string') return new TextEncoder().encode(output); | ||
else return output; | ||
} |