FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
FluentRead/userscript/compression.ts at main · FluentRead/FluentRead · GitHub
FluentRead
/
FluentRead
Public
Notifications
You must be signed in to change notification settings
Fork
422
Star
8.2k
Code
Issues
11
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
FluentRead
/
userscript
/
compression.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
12 lines (11 loc) · 580 Bytes
Breadcrumbs
FluentRead
/
userscript
/
compression.ts
Copy path
File metadata and controls
12 lines (11 loc) · 580 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
import
{
inflateWithPako
}
from
'@/userscript/pakoRuntime'
;
/** 解开内嵌的 gzip 文本;旧内核使用脚本管理器预载或内置的 pako。 */
export
async
function
inflateGzipBase64
(
base64
:
string
)
:
Promise
<
string
>
{
const
binary
=
atob
(
base64
)
;
const
bytes
=
Uint8Array
.
from
(
binary
,
(
character
)
=>
character
.
charCodeAt
(
0
)
)
;
if
(
typeof
DecompressionStream
===
'function'
)
{
const
stream
=
new
Blob
(
[
bytes
]
)
.
stream
(
)
.
pipeThrough
(
new
DecompressionStream
(
'gzip'
)
)
;
return
new
Response
(
stream
)
.
text
(
)
;
}
return
inflateWithPako
(
bytes
)
;
}
Back
|
FazBrowse Home
|
New Git URL