@esmx/fetch 3.0.0-rc.18 → 3.0.0-rc.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Vanelink
3
+ Copyright (c) 2020 Esmx Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ <div align="center">
2
+ <img src="https://www.esmnext.com/logo.svg?t=2025" width="120" alt="Esmx Logo" />
3
+ <h1>@esmx/fetch</h1>
4
+
5
+ <div>
6
+ <a href="https://www.npmjs.com/package/@esmx/fetch">
7
+ <img src="https://img.shields.io/npm/v/@esmx/fetch.svg" alt="npm version" />
8
+ </a>
9
+ <a href="https://github.com/esmnext/esmx/actions/workflows/build.yml">
10
+ <img src="https://github.com/esmnext/esmx/actions/workflows/build.yml/badge.svg" alt="Build" />
11
+ </a>
12
+ <a href="https://www.esmnext.com/coverage/">
13
+ <img src="https://img.shields.io/badge/coverage-live%20report-brightgreen" alt="Coverage Report" />
14
+ </a>
15
+ <a href="https://nodejs.org/">
16
+ <img src="https://img.shields.io/node/v/@esmx/fetch.svg" alt="node version" />
17
+ </a>
18
+ <a href="https://bundlephobia.com/package/@esmx/fetch">
19
+ <img src="https://img.shields.io/bundlephobia/minzip/@esmx/fetch" alt="size" />
20
+ </a>
21
+ </div>
22
+
23
+ <p>Universal HTTP client for Esmx framework with caching and progress support</p>
24
+
25
+ <p>
26
+ English | <a href="https://github.com/esmnext/esmx/blob/master/packages/fetch/README.zh-CN.md">中文</a>
27
+ </p>
28
+ </div>
29
+
30
+ ## 🚀 Features
31
+
32
+ - **Node.js Optimized** - Specifically designed for Node.js server-side environments
33
+ - **Smart Caching** - Built-in intelligent caching mechanism
34
+ - **Progress Tracking** - Download progress support with CLI progress bars
35
+ - **TypeScript Ready** - Full TypeScript support with excellent type safety
36
+ - **Axios Based** - Built on top of the reliable Axios library
37
+ - **Lightweight** - Minimal footprint with essential features
38
+
39
+ ## 📦 Installation
40
+
41
+ ```bash
42
+ npm install @esmx/fetch
43
+ ```
44
+
45
+ ## 📚 Documentation
46
+
47
+ Visit the [official documentation](https://www.esmnext.com) for detailed usage guides and API reference.
48
+
49
+ ## 📄 License
50
+
51
+ MIT © [Esmx Team](https://github.com/esmnext/esmx)
@@ -0,0 +1,51 @@
1
+ <div align="center">
2
+ <img src="https://www.esmnext.com/logo.svg?t=2025" width="120" alt="Esmx Logo" />
3
+ <h1>@esmx/fetch</h1>
4
+
5
+ <div>
6
+ <a href="https://www.npmjs.com/package/@esmx/fetch">
7
+ <img src="https://img.shields.io/npm/v/@esmx/fetch.svg" alt="npm version" />
8
+ </a>
9
+ <a href="https://github.com/esmnext/esmx/actions/workflows/build.yml">
10
+ <img src="https://github.com/esmnext/esmx/actions/workflows/build.yml/badge.svg" alt="Build" />
11
+ </a>
12
+ <a href="https://www.esmnext.com/coverage/">
13
+ <img src="https://img.shields.io/badge/coverage-live%20report-brightgreen" alt="Coverage Report" />
14
+ </a>
15
+ <a href="https://nodejs.org/">
16
+ <img src="https://img.shields.io/node/v/@esmx/fetch.svg" alt="node version" />
17
+ </a>
18
+ <a href="https://bundlephobia.com/package/@esmx/fetch">
19
+ <img src="https://img.shields.io/bundlephobia/minzip/@esmx/fetch" alt="size" />
20
+ </a>
21
+ </div>
22
+
23
+ <p>为 Esmx 框架提供的通用 HTTP 客户端,支持缓存和进度追踪</p>
24
+
25
+ <p>
26
+ <a href="https://github.com/esmnext/esmx/blob/master/packages/fetch/README.md">English</a> | 中文
27
+ </p>
28
+ </div>
29
+
30
+ ## 🚀 特性
31
+
32
+ - **Node.js 优化** - 专为 Node.js 服务端环境设计
33
+ - **智能缓存** - 内置智能缓存机制
34
+ - **进度追踪** - 下载进度支持和 CLI 进度条
35
+ - **TypeScript 就绪** - 完整的 TypeScript 支持,出色的类型安全
36
+ - **基于 Axios** - 构建在可靠的 Axios 库之上
37
+ - **轻量级** - 最小化体积,包含核心功能
38
+
39
+ ## 📦 安装
40
+
41
+ ```bash
42
+ npm install @esmx/fetch
43
+ ```
44
+
45
+ ## 📚 文档
46
+
47
+ 访问[官方文档](https://www.esmnext.com)获取详细的使用指南和 API 参考。
48
+
49
+ ## 📄 许可证
50
+
51
+ MIT © [Esmx Team](https://github.com/esmnext/esmx)
package/package.json CHANGED
@@ -34,17 +34,16 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@biomejs/biome": "1.9.4",
37
- "@esmx/lint": "3.0.0-rc.18",
38
- "@gez/lint": "3.0.0-rc.9",
37
+ "@esmx/lint": "3.0.0-rc.20",
39
38
  "@types/cli-progress": "^3.11.6",
40
- "@types/node": "22.13.10",
41
- "@vitest/coverage-v8": "3.0.8",
42
- "stylelint": "16.15.0",
39
+ "@types/node": "22.15.18",
40
+ "@vitest/coverage-v8": "3.1.3",
41
+ "stylelint": "16.19.1",
43
42
  "typescript": "5.8.2",
44
- "unbuild": "2.0.0",
45
- "vitest": "3.0.8"
43
+ "unbuild": "3.5.0",
44
+ "vitest": "3.1.3"
46
45
  },
47
- "version": "3.0.0-rc.18",
46
+ "version": "3.0.0-rc.20",
48
47
  "type": "module",
49
48
  "private": false,
50
49
  "exports": {
@@ -63,5 +62,5 @@
63
62
  "template",
64
63
  "public"
65
64
  ],
66
- "gitHead": "79ceb323f985dd88dbd7f1349f61f341b6d522c4"
65
+ "gitHead": "4c6490c23cbc148cb189b3f2cdae930eed901607"
67
66
  }
package/src/utils.ts CHANGED
@@ -59,8 +59,8 @@ export async function downloadFile(
59
59
  const hashStream = hash ? crypto.createHash(hashAlg) : null;
60
60
  const fileStream = fs.createWriteStream(filePath);
61
61
 
62
- const streamPromise = new Promise((resolve, reject) => {
63
- fileStream.on('finish', resolve as () => void);
62
+ const streamPromise = new Promise<void>((resolve, reject) => {
63
+ fileStream.on('finish', resolve);
64
64
  fileStream.on('error', reject);
65
65
  });
66
66
  result.data.on('data', (chunk: crypto.BinaryLike) => {