koa-files 3.2.0 → 3.2.2

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/cjs/Service.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/cjs/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/cjs/utils/fs.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
@@ -157,7 +157,8 @@ function parseRanges(context, stats) {
157
157
  // Range suffix.
158
158
  const suffix = buffer.Buffer.from(`\r\n--${boundary}--\r\n`);
159
159
  // Override Content-Type.
160
- response.type = `multipart/byteranges; boundary="${boundary}"`;
160
+ // https://httpwg.org/specs/rfc9110.html#multipart.byteranges
161
+ response.type = `multipart/byteranges; boundary=${boundary}`;
161
162
  // Map ranges.
162
163
  for (const [index, { start, end }] of entries) {
163
164
  const length = end - start + 1;
@@ -165,7 +166,7 @@ function parseRanges(context, stats) {
165
166
  const contentRange = `Content-Range: bytes ${start}-${end}/${size}`;
166
167
  const prefix = buffer.Buffer.from(`${head}--${boundary}\r\n${contentType}\r\n${contentRange}\r\n\r\n`);
167
168
  // Compute Content-Length
168
- contentLength += length + prefix.length;
169
+ contentLength += prefix.length + length;
169
170
  // Cache range.
170
171
  ranges.push({ offset: start, length, prefix });
171
172
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/esm/ReadStream.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/esm/Service.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/esm/utils/fs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/esm/utils/hash.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/esm/utils/http.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
@@ -149,7 +149,8 @@ function parseRanges(context, stats) {
149
149
  // Range suffix.
150
150
  const suffix = Buffer.from(`\r\n--${boundary}--\r\n`);
151
151
  // Override Content-Type.
152
- response.type = `multipart/byteranges; boundary="${boundary}"`;
152
+ // https://httpwg.org/specs/rfc9110.html#multipart.byteranges
153
+ response.type = `multipart/byteranges; boundary=${boundary}`;
153
154
  // Map ranges.
154
155
  for (const [index, { start, end }] of entries) {
155
156
  const length = end - start + 1;
@@ -157,7 +158,7 @@ function parseRanges(context, stats) {
157
158
  const contentRange = `Content-Range: bytes ${start}-${end}/${size}`;
158
159
  const prefix = Buffer.from(`${head}--${boundary}\r\n${contentType}\r\n${contentRange}\r\n\r\n`);
159
160
  // Compute Content-Length
160
- contentLength += length + prefix.length;
161
+ contentLength += prefix.length + length;
161
162
  // Cache range.
162
163
  ranges.push({ offset: start, length, prefix });
163
164
  }
package/esm/utils/path.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.2.0
4
+ * @version 3.2.2
5
5
  * @author nuintun <nuintun@qq.com>
6
6
  * @description A static files serving middleware for koa.
7
7
  * @see https://github.com/nuintun/koa-files#readme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koa-files",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "A static files serving middleware for koa.",
5
5
  "type": "module",
6
6
  "main": "cjs/index.cjs",
@@ -57,7 +57,7 @@
57
57
  "dependencies": {
58
58
  "etag": "^1.8.1",
59
59
  "range-parser": "^1.2.1",
60
- "tslib": "^2.8.0"
60
+ "tslib": "^2.8.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@rollup/plugin-typescript": "^12.1.1",
@@ -68,7 +68,7 @@
68
68
  "magic-string": "^0.30.12",
69
69
  "prettier": "^3.3.3",
70
70
  "rimraf": "^6.0.1",
71
- "rollup": "^4.24.0",
71
+ "rollup": "^4.24.3",
72
72
  "tsc-alias": "^1.8.10",
73
73
  "typescript": "^5.6.3"
74
74
  },