koa-files 3.1.8 → 3.1.9

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/cjs/Service.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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
@@ -32,7 +32,7 @@ const CHARS = [
32
32
  * @description Generate a hash.
33
33
  * @param length The length of hash.
34
34
  */
35
- function generate(length = 32) {
35
+ function generate(length) {
36
36
  let hash = '';
37
37
  const randomValues = crypto.getRandomValues(new Uint8Array(length));
38
38
  // Create hash.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.1.8
4
+ * @version 3.1.9
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
@@ -156,13 +156,13 @@ function parseRanges(context, stats) {
156
156
  // Parsed entries.
157
157
  const entries = parsed.entries();
158
158
  // Range boundary.
159
- const boundary = `<${hash.generate()}>`;
159
+ const boundary = `${hash.generate(32)}`;
160
160
  // Multipart Content-Type.
161
161
  const contentType = `Content-Type: ${context.type}`;
162
162
  // Range suffix.
163
163
  const suffix = buffer.Buffer.from(`\r\n--${boundary}--\r\n`);
164
164
  // Override Content-Type.
165
- context.type = `multipart/byteranges; boundary=${boundary}`;
165
+ context.type = `multipart/byteranges; boundary="${boundary}"`;
166
166
  // Map ranges.
167
167
  for (const [index, { start, end }] of entries) {
168
168
  const length = end - start + 1;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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
@@ -30,7 +30,7 @@ const CHARS = [
30
30
  * @description Generate a hash.
31
31
  * @param length The length of hash.
32
32
  */
33
- function generate(length = 32) {
33
+ function generate(length) {
34
34
  let hash = '';
35
35
  const randomValues = getRandomValues(new Uint8Array(length));
36
36
  // Create hash.
package/esm/utils/http.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.1.8
4
+ * @version 3.1.9
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
@@ -148,13 +148,13 @@ function parseRanges(context, stats) {
148
148
  // Parsed entries.
149
149
  const entries = parsed.entries();
150
150
  // Range boundary.
151
- const boundary = `<${generate()}>`;
151
+ const boundary = `${generate(32)}`;
152
152
  // Multipart Content-Type.
153
153
  const contentType = `Content-Type: ${context.type}`;
154
154
  // Range suffix.
155
155
  const suffix = Buffer.from(`\r\n--${boundary}--\r\n`);
156
156
  // Override Content-Type.
157
- context.type = `multipart/byteranges; boundary=${boundary}`;
157
+ context.type = `multipart/byteranges; boundary="${boundary}"`;
158
158
  // Map ranges.
159
159
  for (const [index, { start, end }] of entries) {
160
160
  const length = end - start + 1;
package/esm/utils/path.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @package koa-files
3
3
  * @license MIT
4
- * @version 3.1.8
4
+ * @version 3.1.9
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.1.8
4
+ * @version 3.1.9
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.1.8",
3
+ "version": "3.1.9",
4
4
  "description": "A static files serving middleware for koa.",
5
5
  "type": "module",
6
6
  "main": "cjs/index.cjs",
@@ -6,4 +6,4 @@
6
6
  * @description Generate a hash.
7
7
  * @param length The length of hash.
8
8
  */
9
- export declare function generate(length?: number): string;
9
+ export declare function generate(length: number): string;