# @gmod/http-range-fetcher 中文文档

规范地址：https://npmcn.com/package/%40gmod/http-range-fetcher/

版本：5\.0\.7
npm 元数据更新时间：2026-08-03T19:46:22.706Z
中文译文更新时间：2026-11-16T17:11:02.380Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40gmod/http-range-fetcher
原文对照：https://npmcn.com/package/%40gmod/http-range-fetcher/?lang=original
源码仓库：https://github.com/rbuels/http-range-fetcher

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

- 包体积（解压后）：70.1 kB，30 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：1 个
- 首次发布：2024-06-21T10:12:21.411Z
- 最新版本发布：2026-01-15T14:46:05.937Z
- 近 30 天下载量：18122（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：11（近 12 个月 4 个）

## 中文简介

缓存、 汇总处理许多 HTTP 范围请求的抓取管理器

## 安装

```sh
npm install @gmod/http-range-fetcher
```

也可以使用：`pnpm add @gmod/http-range-fetcher`、`yarn add @gmod/http-range-fetcher`、`bun add @gmod/http-range-fetcher`

## README

# @gmod/http-range-fetcher (英语)

[![NPM version](https://img.shields.io/npm/v/@gmod/http-range-fetcher.svg?style=flat-square)](https://npmjs.org/package/@gmod/http-range-fetcher) [![Build Status](https://img.shields.io/github/actions/workflow/status/rbuels/http-range-fetcher/push.yml?branch=master)](https://github.com/rbuels/http-range-fetcher/actions?query=branch%3Amaster+workflow%3APush+)

HTTP 字节范围请求的缓存/ 管理器, 将请求合并到一起并 缓存结果 。 为请求很多小字节范围的应用程序所设计 超过经常相邻的HTTP.

工作在节点或网络包装/浏览验证。 尊重 HTTP 缓存语义 除外,对于下列请求,设定最低1秒的默认TTL: 并非真的应该被缓存( 例如) . `Cache-Control: no-cache`) (中文(简体) ). 你可以转身 通过设置取消行为 `minimumTTL` 倒计时.

## 安装

```
$ npm install --save http-range-fetcher
```

## 使用量

```js
const { HttpRangeFetcher } = require('http-range-fetcher')

const cache = new HttpRangeFetcher({})
cache.getRange('http://foo.bar/baz.bam', 20, 10).then(response => {
  assert(response.buffer.length === 10)
  assert(response.headers['content-range'] === '20-29/23422')
  // response objects contain `headers` and `buffer`.  the `headers` object
  // contains the original headers that came from the server in response to the
  // aggregated call, except the Content-Range header has been overwritten
  // to match the requested range, and it adds a X-Resource-Length header that
  // conveniently gives the total length of the remote resource so you don't
  // have to parse the Content-Range header.
  assert(response.headers['x-resource-length'] === '23422')
})

// these will be aggregated behind the scenes
// as a single request for a big chunk of the remote file,
// which will be cached to satisfy subsequent requests
Promise.all([
  cache.getRange('http://foo.bar/baz.bam', 20, 10),
  cache.getRange('http://foo.bar/baz.bam', 30, 10),
  cache.getRange('http://foo.bar/baz.bam', 40, 10),
  cache.getRange('http://foo.bar/baz.bam', 50, 10),
  cache.getRange('http://foo.bar/baz.bam', 60, 10),
  cache.getRange('http://foo.bar/baz.bam', 70, 10),
]).then(fetchResults => {
  fetchResults.forEach(res => assert(res.buffer.length === 10))
})
```

### 目录

## 学术用途

这一一揽子计划是利用来自 [(原始内容存档于2018-09-21) (韩语). NHGRI](http://genome.gov/) 作为 页:1 [J 浏览](http://jbrowse.org/) 项目。 如果你在学术中使用它 请引用最近发表的JBrowse论文 链接从 [jbrowse.org (英语)](http://jbrowse.org/)。 。 。 .

## 许可证

麻省理工学院 [罗伯特·布厄尔斯](https://github.com/rbuels)

## 说明

2024年更名为 http-range-fetcher - > @gmod/http-range-fetcher

## 常见问题

### @gmod/http-range-fetcher 是什么？

缓存、 汇总处理许多 HTTP 范围请求的抓取管理器

### 如何安装 @gmod/http-range-fetcher？

在项目目录运行 npm install @gmod/http-range-fetcher，或使用 pnpm add / yarn add / bun add。

### @gmod/http-range-fetcher 支持 TypeScript 吗？

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

### @gmod/http-range-fetcher 支持 ESM 还是 CommonJS？

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

### @gmod/http-range-fetcher 可以商用吗？

@gmod/http-range-fetcher 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @gmod/http-range-fetcher 的下载量有多少？

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

### @gmod/http-range-fetcher 还在维护吗？

最新版本 5\.0\.7 发布于 2026/01/15（10 个月前）；至今共发布 11 个版本，其中过去 12 个月发布了 4 个；首次发布于 2024/06/21。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

