@gmod/http-range-fetcher

中文文档
5.0.7发布于 2026/01/15MITTypeScriptESM + CJS近 30 天下载 1.8万

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

中文使用文档
文档目录6 节
  1. 安装
  2. 使用量
  3. 目录
  4. 学术用途
  5. 许可证
  6. 说明

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

NPM version Build Status

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

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

安装

$ npm install --save http-range-fetcher

使用量

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 作为 页:1 J 浏览 项目。 如果你在学术中使用它 请引用最近发表的JBrowse论文 链接从 jbrowse.org (英语)。 。 。 .

许可证

麻省理工学院 罗伯特·布厄尔斯

说明

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

版本与发布记录

@gmod/http-range-fetcher 共发布 11 个版本,首次发布于 2024/06/21;过去 12 个月发布了 4 个版本。

版本发布日期距今
5.0.7latest2026/01/1510 个月前
5.0.62025/12/2110 个月前
5.0.52025/12/1810 个月前
5.0.32025/12/1810 个月前
5.0.12025/05/141.5 年前
5.0.02025/04/301.5 年前

关于 @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 和提交记录判断。