# @adobe/helix-fetch 中文文档

规范地址：https://npmcn.com/package/%40adobe/helix-fetch/

版本：3\.1\.2
npm 元数据更新时间：2026-10-01T01:34:01.302Z
中文译文更新时间：2026-11-06T06:45:36.860Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40adobe/helix-fetch
原文对照：https://npmcn.com/package/%40adobe/helix-fetch/?lang=original
项目主页：https://github.com/adobe/helix-fetch#readme
源码仓库：https://github.com/adobe/helix-fetch

弃用说明：WARNING: This project has been renamed to @adobe/fetch\. Install using @adobe/fetch instead\.

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：142 kB，24 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=12\.0
- 运行依赖：3 个
- 首次发布：2020-01-31T17:04:35.441Z
- 最新版本发布：2022-08-07T07:20:05.262Z
- 近 30 天下载量：4368（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：51（近 12 个月 0 个）

## 中文简介

透明地获取执行,支持HTTP/1(1)和HTTP/2

## 安装

```sh
npm install @adobe/helix-fetch
```

也可以使用：`pnpm add @adobe/helix-fetch`、`yarn add @adobe/helix-fetch`、`bun add @adobe/helix-fetch`

## README

![Helix Fetch](https://npmcn.com/package/%40adobe/helix-fetch/banner.jpeg)  

重量 [获取 API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) 以透明方式支持这两个项目 **HTTP/1(1个)** 财务报告和审定财务报表 **HTTP/2 导弹**

[![codecov](https://img.shields.io/codecov/c/github/adobe/helix-fetch.svg)](https://codecov.io/gh/adobe/helix-fetch) [![CircleCI](https://img.shields.io/circleci/project/github/adobe/helix-fetch.svg)](https://circleci.com/gh/adobe/helix-fetch) [![GitHub license](https://img.shields.io/github/license/adobe/helix-fetch.svg)](https://github.com/adobe/helix-fetch/blob/main/LICENSE.txt) [![GitHub issues](https://img.shields.io/github/issues/adobe/helix-fetch.svg)](https://github.com/adobe/helix-fetch/issues) [![LGTM Code Quality Grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/helix-fetch.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/adobe/helix-fetch) [![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Install size](https://badgen.net/packagephobia/install/@adobe/helix-fetch)](https://packagephobia.now.sh/result?p=@adobe/helix-fetch) [![Current version](https://img.shields.io/npm/v/@adobe/helix-fetch)](https://www.npmjs.com/package/@adobe/helix-fetch)

* * *

-   [关于](https://npmcn.com/package/%40adobe/helix-fetch/#readme-about)
-   [特征](https://npmcn.com/package/%40adobe/helix-fetch/#readme-features)
-   [安装](https://npmcn.com/package/%40adobe/helix-fetch/#readme-installation)
-   [升级](https://npmcn.com/package/%40adobe/helix-fetch/#readme-upgrading)
-   [API 密码](https://npmcn.com/package/%40adobe/helix-fetch/#readme-api)
    -   [A. 背景情况](https://npmcn.com/package/%40adobe/helix-fetch/#readme-context)
-   [常用示例](https://npmcn.com/package/%40adobe/helix-fetch/#readme-common-usage-examples)
    -   [访问响应信头和其他元数据](https://npmcn.com/package/%40adobe/helix-fetch/#readme-access-response-headers-and-other-meta-data)
    -   [获取 JSON](https://npmcn.com/package/%40adobe/helix-fetch/#readme-fetch-json)
    -   [获取文本数据](https://npmcn.com/package/%40adobe/helix-fetch/#readme-fetch-text-data)
    -   [获取二进制数据](https://npmcn.com/package/%40adobe/helix-fetch/#readme-fetch-binary-data)
    -   [指定超时 `fetch` 操作](https://npmcn.com/package/%40adobe/helix-fetch/#readme-specify-a-timeout-for-a-fetch-operation)
    -   [流出图像](https://npmcn.com/package/%40adobe/helix-fetch/#readme-stream-an-image)
    -   [JSON 员额](https://npmcn.com/package/%40adobe/helix-fetch/#readme-post-json)
    -   [后 JPEG 图像](https://npmcn.com/package/%40adobe/helix-fetch/#readme-post-jpeg-image)
    -   [表格数据](https://npmcn.com/package/%40adobe/helix-fetch/#readme-post-form-data)
    -   [获取查询参数对象](https://npmcn.com/package/%40adobe/helix-fetch/#readme-get-with-query-parameters-object)
    -   [缓存](https://npmcn.com/package/%40adobe/helix-fetch/#readme-cache)
-   [高级使用示例](https://npmcn.com/package/%40adobe/helix-fetch/#readme-advanced-usage-examples)
    -   [HTTP/2 服务器推](https://npmcn.com/package/%40adobe/helix-fetch/#readme-http2-server-push)
    -   [强制 HTTP/1(1) 协议](https://npmcn.com/package/%40adobe/helix-fetch/#readme-force-http11-protocol)
    -   [HTTP/1.1 保持寿命](https://npmcn.com/package/%40adobe/helix-fetch/#readme-http11-keep-alive)
    -   [自签名证书](https://npmcn.com/package/%40adobe/helix-fetch/#readme-self-signed-certificates)
    -   [设定缓存大小限制](https://npmcn.com/package/%40adobe/helix-fetch/#readme-set-cache-size-limit)
    -   [禁用缓存](https://npmcn.com/package/%40adobe/helix-fetch/#readme-disable-caching)
    -   [设置自定义用户代理](https://npmcn.com/package/%40adobe/helix-fetch/#readme-set-a-custom-user-agent)
-   [更多实例](https://npmcn.com/package/%40adobe/helix-fetch/#readme-more-examples)
-   [发展](https://npmcn.com/package/%40adobe/helix-fetch/#readme-development)
    -   [构建](https://npmcn.com/package/%40adobe/helix-fetch/#readme-build)
    -   [测试](https://npmcn.com/package/%40adobe/helix-fetch/#readme-test)
    -   [林特](https://npmcn.com/package/%40adobe/helix-fetch/#readme-lint)
    -   [解决问题](https://npmcn.com/package/%40adobe/helix-fetch/#readme-troubleshooting)
-   [致谢](https://npmcn.com/package/%40adobe/helix-fetch/#readme-acknowledgement)
-   [许可证](https://npmcn.com/package/%40adobe/helix-fetch/#readme-license)

* * *

## 关于

`helix-fetch` 一般遵守 [获取 API 规格](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API),执行 API 的子集。 然而,有一些明显的偏差:

-   `Response.body` 返回节点.js [可读流](https://nodejs.org/api/stream.html#stream_readable_streams)。 。 。 .
-   `Response.blob()` 未执行。 使用 `Response.buffer()` 换句话说.
-   `Response.formData()` 未执行.
-   饼干不是默认保存的. 然而,饼干可以通过操纵请求和响应头来取出并传递.
-   以下数值 `fetch()` 选项 `cache` 已支持: `'default'` 和 `'no-store'`。所有其他值目前都被忽略.
-   以下内容: `fetch()` 由于Node.js的性质,自此,选项被忽略 `helix-fetch` 没有网页的概念: `mode`, (中文(简体) ), `referrer`, (中文(简体) ), `referrerPolicy`, (中文(简体) ), `integrity` 财务报告和审定财务报表 `credentials`。 。 。 .
-   这个 `fetch()` 选项 `keepalive` 不被支持。 但你可以使用这个 `h1.keepAlive` 显示的上下文选项 [这里](https://npmcn.com/package/%40adobe/helix-fetch/#readme-http11-keep-alive)。 。 。 .

`helix-fetch` 还支持以下扩展:

-   `Response.buffer()` 返回节点.js `Buffer`。 。 。 .
-   `Response.url` 包含跟踪方向调整时的最后url.
-   这个 `body` 可以发送到 `Request` 也可以是一个 `Readable` 节点.js流, a `Buffer`、字符串或普通对象.
-   没有禁用的标题.
-   这个 `Response` 对象有额外的属性 `httpVersion` 这是其中之一 `'1.0'`, (中文(简体) ), `'1.1'` 或者说 `'2.0'`,取决于与服务器谈判的内容.
-   这个 `Response` 对象有额外的属性 `fromCache` 它决定了是否从缓存中检索到答复.
-   这个 `Response` 对象有额外的属性 `decoded` 决定响应机构是否自动解码(参见获取选项) `decode` 页:1.
-   `Response.headers.plain()` 返回信头为普通对象.
-   获取选项 `follow` 允许限制要遵循的重定向次数( 默认 : `20`) (中文(简体) ).
-   获取选项 `compress` 允许透明 gzip/deflate/br 内容编码( 默认 ): `true`) (中文(简体) ).
-   获取选项 `decode` 允许透明 gzip/deflate/br 内容解码( 默认 ): `true`) (中文(简体) ).

注意非标准获取选项已与 [节点比对](https://github.com/node-fetch/node-fetch) 在适当情况下.

## 特征

-   [x] 支持标准的合理子集 [获取规格](https://fetch.spec.whatwg.org/)
-   [x] HTTP/1(1)和HTTP/2连接的透明处理
-   [x] [RFC 7234 (英语)](https://httpwg.org/specs/rfc7234.html) 符合的缓存
-   [x] 支助 `gzip/deflate/br` 内容编码
-   [x] HTTP/2 请求和响应多功能支持
-   [x] HTTP/2 服务器 Push 支持(透明缓存和明确的收听器支持)
-   [x] 压倒性用户代理
-   [x] 低等HTTP/1.\* 代理/连接选项支持(例如:. `keepAlive`, (中文(简体) ), `rejectUnauthorized`(中文(简体) )

## 安装

> **说明**数字 :
> 
> 截至v2节点版本需要QQ 12.

```bash
$ npm install @adobe/helix-fetch
```

## 升级

从旧版本升级 `helix-fetch`检查以下文件 :

-   [1.x至2.x 升级指南](https://npmcn.com/package/%40adobe/helix-fetch/v2-UPGRADE-GUIDE.md)
-   [更改日志](https://npmcn.com/package/%40adobe/helix-fetch/CHANGELOG.md)

## API 密码

除了标准获取 API

-   `fetch()`
-   `Request`
-   `Response`
-   `Headers`
-   `Body`

`helix-fetch` 曝光以下扩展 :

-   `context()` - 创建新定制的 API 上下文
-   `reset()` - 重置当前 API 上下文,即关闭待决会话/ sockets,清除内部缓存等.
-   `onPush()` - 注册 HTTP/2 服务器 Push 听器
-   `offPush()`\- 取消先前注册的听众的登记 `onPush()`
-   `clearCache()` - 清除 HTTP 缓存( 紧急回复)
-   `cacheStats()` - 返回缓存统计
-   `noCache()` - 创建适合残疾人缓存的API环境(_便利_(中文(简体) )
-   `h1()` - 创建定制的带有HTTP/1.1协议的API上下文(_便利_(中文(简体) )
-   `keepAlive()` - 创建一个定制的API上下文,执行HTTP/1.1协议和持续连接(_便利_(中文(简体) )
-   `h1NoCache()` - 建立一个定制的API环境,其中包含残疾缓存和执行HTTP/1.1协议(_便利_(中文(简体) )
-   `keepAliveNoCache()` - 创建一个定制的API环境,与残疾缓存相接,并强制执行HTTP/1.1协议,与持续连接(_便利_(中文(简体) )
-   `createUrl()` - 创建含有查询参数的URL(_便利_(中文(简体) )
-   `timeoutSignal()` - 发出超时信号(_便利_(中文(简体) )

### A. 背景情况

API上下文允许自定义执行的某些方面,并按API上下文提供内部结构的隔离(会话缓存,HTTP缓存等).

支持以下选项:

```ts
interface ContextOptions {
  /**
   * Value of `user-agent` request header
   * @default 'helix-fetch/<version>'
   */
  userAgent?: string;
  /**
   * The maximum total size of the cached entries (in bytes). 0 disables caching.
   * @default 100 * 1024 * 1024
   */
  maxCacheSize?: number;
  /**
   * The protocols to be negotiated, in order of preference
   * @default [ALPN_HTTP2, ALPN_HTTP1_1, ALPN_HTTP1_0]
   */
  alpnProtocols?: ReadonlyArray< ALPNProtocol >;
  /**
   * How long (in milliseconds) should ALPN information be cached for a given host?
   * @default 60 * 60 * 1000
   */
  alpnCacheTTL?: number;
  /**
   * (HTTPS only, applies to HTTP/1.x and HTTP/2)
   * If not false, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails; err.code contains the OpenSSL error code.
   * @default true
   */
  rejectUnauthorized?: boolean;
  /**
   * Maximum number of ALPN cache entries
   * @default 100
   */
  alpnCacheSize?: number;
  h1?: Http1Options;
  h2?: Http2Options;
};

interface Http1Options {
  /**
   * Keep sockets around in a pool to be used by other requests in the future.
   * @default false
   */
  keepAlive?: boolean;
  /**
   * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive.
   * Only relevant if keepAlive is set to true.
   * @default 1000
   */
  keepAliveMsecs?: number;
  /**
   * (HTTPS only)
   * If not false, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails; err.code contains the OpenSSL error code.
   * @default true
   */
  rejectUnauthorized?: boolean;
  /**
   * (HTTPS only)
   * Maximum number of TLS cached sessions. Use 0 to disable TLS session caching.
   * @default 100
   */
  maxCachedSessions?: number;
}

interface Http2Options {
  /**
   * Max idle time in milliseconds after which a session will be automatically closed. 
   * @default 5 * 60 * 1000
   */
  idleSessionTimeout?: number;
  /**
   * Enable HTTP/2 Server Push?
   * @default true
   */
  enablePush?: boolean;
  /**
   * Max idle time in milliseconds after which a pushed stream will be automatically closed. 
   * @default 5000
   */
  pushedStreamIdleTimeout?: number;
  /**
   * (HTTPS only)
   * If not false, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails; err.code contains the OpenSSL error code.
   * @default true
   */
  rejectUnauthorized?: boolean;
};
```

## 常用示例

### 访问响应信头和其他元数据

```javascript
  const { fetch } = require('@adobe/helix-fetch');

  const resp = await fetch('https://httpbin.org/get');
  console.log(resp.ok);
  console.log(resp.status);
  console.log(resp.statusText);
  console.log(resp.httpVersion);
  console.log(resp.headers.plain());
  console.log(resp.headers.get('content-type'));
```

### 获取 JSON

```javascript
  const { fetch } = require('@adobe/helix-fetch');

  const resp = await fetch('https://httpbin.org/json');
  const jsonData = await resp.json();
```

### 获取文本数据

```javascript
  const { fetch } = require('@adobe/helix-fetch');

  const resp = await fetch('https://httpbin.org/');
  const textData = await resp.text();
```

### 获取二进制数据

```javascript
  const { fetch } = require('@adobe/helix-fetch');

  const resp = await fetch('https://httpbin.org//stream-bytes/65535');
  const imageData = await resp.buffer();
```

### 指定超时 `fetch` 操作

使用 `timeoutSignal(ms)` 扩展名 :

```javascript
  const { fetch, timeoutSignal, AbortError } = require('@adobe/helix-fetch');

  const signal = timeoutSignal(1000);
  try {
    const resp = await fetch('https://httpbin.org/json', { signal });
    const jsonData = await resp.json();
  } catch (err) {
    if (err instanceof AbortError) {
      console.log('fetch timed out after 1s');
    }
  } finally {
    // avoid pending timers which prevent node process from exiting
    signal.clear();
  }
```

使用 `AbortController`数字 :

```javascript
  const { fetch, AbortController, AbortError } = require('@adobe/helix-fetch');

  const controller = new AbortController();
  const timerId = setTimeout(() => controller.abort(), 1000);
  const { signal } = controller;

  try {
    const resp = await fetch('https://httpbin.org/json', { signal });
    const jsonData = await resp.json();
  } catch (err) {
    if (err instanceof AbortError) {
      console.log('fetch timed out after 1s');
    }
  } finally {
    // avoid pending timers which prevent node process from exiting
    clearTimeout(timerId);
  }
```

### 流出图像

```javascript
  const fs = require('fs');
  const { fetch } = require('@adobe/helix-fetch');

  const resp = await fetch('https://httpbin.org/image/jpeg');
  resp.body.pipe(fs.createWriteStream('saved-image.jpg'));
```

### JSON 员额

```javascript
  const { fetch } = require('@adobe/helix-fetch');

  const method = 'POST';
  const body = { foo: 'bar' };
  const resp = await fetch('https://httpbin.org/post', { method, body });
```

### 后 JPEG 图像

```javascript
  const fs = require('fs');
  const { fetch } = require('@adobe/helix-fetch');

  const method = 'POST';
  const body = fs.createReadStream('some-image.jpg');
  const headers = { 'content-type': 'image/jpeg' };
  const resp = await fetch('https://httpbin.org/post', { method, body, headers });
```

### 表格数据

```javascript
  const { FormData, Blob, File } = require('formdata-node'); // spec-compliant implementations
  const { fileFromPath } = require('formdata-node/file-from-path'); // helper for creating File instance from disk file

  const { fetch } = require('@adobe/helix-fetch');

  const method = 'POST';
  const fd = new FormData();
  fd.set('field1', 'foo');
  fd.set('field2', 'bar');
  fd.set('blob', new Blob([0x68, 0x65, 0x6c, 0x69, 0x78, 0x2d, 0x66, 0x65, 0x74, 0x63, 0x68]));
  fd.set('file', new File(['File content goes here'], 'file.txt'));
  fd.set('other_file', await fileFromPath('/foo/bar.jpg', 'bar.jpg', { type: 'image/jpeg' }));
  const resp = await fetch('https://httpbin.org/post', { method, body: fd });
```

### 获取查询参数对象

```javascript
const { createUrl, fetch } = require('@adobe/helix-fetch');

const qs = {
  helix: 'dummy',
  foo: 'bar',
  rumple: "stiltskin",
};

const resp = await fetch(createUrl('https://httpbin.org/json', qs));
```

或使用 `URLSearchParams`数字 :

```javascript
const { fetch } = require('@adobe/helix-fetch');

const body = new URLSearchParams({
  helix: 'dummy',
  foo: 'bar',
  rumple: "stiltskin",
});

const resp = await fetch('https://httpbin.org/json', { body });
```

### 缓存

答复 `GET` 财务报告和审定财务报表 `HEAD` 根据以下规则,请求默认缓存 [RFC 7234 (英语)](https://httpwg.org/specs/rfc7234.html)数字 :

```javascript
const { fetch } = require('@adobe/helix-fetch');

const url = 'https://httpbin.org/cache/60'; // -> max-age=60 (seconds)
// send initial request, priming cache
let resp = await fetch(url);
assert(resp.ok);
assert(!resp.fromCache);

// re-send request and verify it's served from cache
resp = await fetch(url);
assert(resp.ok);
assert(resp.fromCache);
```

您可以禁用每个请求的缓存 `cache: 'no-store'` 选项 :

```javascript
const { fetch } = require('@adobe/helix-fetch');

const resp = await fetch('https://httbin.org/', { cache: 'no-store' });
assert(resp.ok);
assert(!resp.fromCache);
```

您可以完全禁用缓存 :

```javascript
const { fetch } = require('@adobe/helix-fetch').noCache();
```

## 高级使用示例

### HTTP/2 服务器推

注意被推动的资源将自动透明地添加到缓存中. 不过,您可以添加一个将在每个被驱动(和缓存)的资源上被通知的听众 .

```javascript
  const { fetch, onPush } = require('@adobe/helix-fetch');

  onPush((url, response) => console.log(`received server push: ${url} status ${response.status}`));

  const resp = await fetch('https://nghttp2.org');
  console.log(`Http version: ${resp.httpVersion}`);
```

### 强制 HTTP/1(1) 协议

```javascript
  const { fetch } = require('@adobe/helix-fetch').h1();

  const resp = await fetch('https://nghttp2.org');
  console.log(`Http version: ${resp.httpVersion}`);
```

### HTTP/1.1 保持寿命

```javascript
const { fetch } = require('@adobe/helix-fetch').keepAlive();

const resp = await fetch('https://httpbin.org/status/200');
console.log(`Connection: ${resp.headers.get('connection')}`); // -> keep-alive
```

### 自签名证书

```javascript
const { fetch } = require('@adobe/helix-fetch').context({ rejectUnauthorized: false });

const resp = await fetch('https://localhost:8443/');  // a server using a self-signed certificate
```

### 设定缓存大小限制

```javascript
  const { fetch, cacheStats } = require('@adobe/helix-fetch').context({
    maxCacheSize: 100 * 1024, // 100kb (Default: 100mb)
  });

  let resp = await fetch('https://httpbin.org/bytes/60000'); // ~60kb response
  resp = await fetch('https://httpbin.org/bytes/50000'); // ~50kb response
  console.log(cacheStats());
```

### 禁用缓存

```javascript
  const { fetch } = require('@adobe/helix-fetch').noCache();

  let resp = await fetch('https://httpbin.org/cache/60'); // -> max-age=60 (seconds)
  // re-fetch
  resp = await fetch('https://httpbin.org/cache/60');
  assert(!resp.fromCache);
```

### 设置自定义用户代理

```javascript
  const { fetch } = require('@adobe/helix-fetch').context({
    userAgent: 'custom-fetch'
  });

  const resp = await fetch('https://httpbin.org//user-agent');
  const json = await resp.json();
  console.log(json['user-agent']);
```

## 更多实例

可在 [测试源文件](https://npmcn.com/test/)。 。 。 .

## 发展

### 构建

```bash
$ npm install
```

### 测试

```bash
$ npm test
```

### 林特

```bash
$ npm run lint
```

### 解决问题

您可以启用 `helix-fetch` 设置低级调试控制台输出 `DEBUG` 环境变量改为 `helix-fetch*`,例如:

```bash
$ DEBUG=helix-fetch* node test.js
```

这将产生类似于下列控制台外出:

```bash
  ...
  helix-fetch:core established TLS connection: #48 (www.nghttp2.org) +2s
  helix-fetch:core www.nghttp2.org -> h2 +0ms
  helix-fetch:h2 reusing socket #48 (www.nghttp2.org) +2s
  helix-fetch:h2 GET www.nghttp2.org/httpbin/user-agent +0ms
  helix-fetch:h2 session https://www.nghttp2.org established +1ms
  helix-fetch:h2 caching session https://www.nghttp2.org +0ms
  helix-fetch:h2 session https://www.nghttp2.org remoteSettings: {"headerTableSize":8192,"enablePush":true,"initialWindowSize":1048576,"maxFrameSize":16384,"maxConcurrentStreams":100,"maxHeaderListSize":4294967295,"maxHeaderSize":4294967295,"enableConnectProtocol":true} +263ms
  helix-fetch:h2 session https://www.nghttp2.org localSettings: {"headerTableSize":4096,"enablePush":true,"initialWindowSize":65535,"maxFrameSize":16384,"maxConcurrentStreams":4294967295,"maxHeaderListSize":4294967295,"maxHeaderSize":4294967295,"enableConnectProtocol":false} +0ms
  helix-fetch:h2 session https://www.nghttp2.org closed +6ms
  helix-fetch:h2 discarding cached session https://www.nghttp2.org +0ms
  ... 
```

此外,您可以通过设置节点.js低等调试控制台输出 `NODE_DEBUG` 环境可适当变,例如:.

```bash
$ export NODE_DEBUG=http*,stream*
$ export DEBUG=helix-fetch*

$ node test.js
```

> 注意:这将用高活字调试输出来淹没控制台.

## 致谢

感谢 [节点比对](https://github.com/node-fetch/node-fetch) 财务报告和审定财务报表 [gi/牵引](https://github.com/github/fetch) 提供坚实的执行参考.

## 许可证

[Apache 2.0 (英语)](https://npmcn.com/package/%40adobe/helix-fetch/LICENSE.txt)

## 常见问题

### @adobe/helix-fetch 是什么？

透明地获取执行,支持HTTP/1\(1\)和HTTP/2注意：该包已被作者标记为弃用——WARNING: This project has been renamed to @adobe/fetch\. Install using @adobe/fetch instead\.

### 如何安装 @adobe/helix-fetch？

在项目目录运行 npm install @adobe/helix-fetch，或使用 pnpm add / yarn add / bun add。

### @adobe/helix-fetch 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @adobe/helix-fetch 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @adobe/helix-fetch 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=12\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @adobe/helix-fetch 可以商用吗？

@adobe/helix-fetch 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @adobe/helix-fetch 的下载量有多少？

根据 npm 官方下载统计，@adobe/helix-fetch 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,368 次，日均约 146 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @adobe/helix-fetch 还在维护吗？

最新版本 3\.1\.2 发布于 2022/08/07（4 年前）；至今共发布 51 个版本，其中过去 12 个月发布了 0 个；首次发布于 2020/02/01。作者已将其标记为弃用，新项目建议寻找替代方案。

