perf: accept gzip, deflate encoding from the registry (#3745)

ref #3738
This commit is contained in:
Zoltan Kochan
2021-09-05 02:02:59 +03:00
committed by GitHub
parent bd4537c541
commit eadf0e5052
5 changed files with 15 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/fetch": minor
"@pnpm/fetching-types": minor
---
New optional option added: compress.

View File

@@ -0,0 +1,6 @@
---
"@pnpm/npm-resolver": patch
---
The metadata file should be requested in compressed state.

View File

@@ -43,7 +43,7 @@ export default function (
const response = await fetch(urlObject, {
agent,
// if verifying integrity, node-fetch must not decompress
compress: false,
compress: opts?.compress ?? false,
headers,
redirect: 'manual',
retry: opts?.retry,

View File

@@ -7,6 +7,7 @@ export type FetchFromRegistry = (
url: string,
opts?: {
authHeaderValue?: string
compress?: boolean
retry?: RetryTimeoutOptions
timeout?: number
}

View File

@@ -54,6 +54,7 @@ export default async function fromRegistry (
try {
response = await fetch(uri, {
authHeaderValue,
compress: true,
retry: fetchOpts.retry,
timeout: fetchOpts.timeout,
}) as RegistryResponse