geonix 1.23.5 → 1.23.6
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/package.json +2 -2
- package/src/Gateway.js +1 -3
- package/test/upload.js +17 -6
package/package.json
CHANGED
package/src/Gateway.js
CHANGED
|
@@ -10,8 +10,6 @@ import semver from "semver";
|
|
|
10
10
|
import { WebSocket } from "ws";
|
|
11
11
|
import { logger } from "./Logger.js";
|
|
12
12
|
|
|
13
|
-
const raw = express.raw({ limit: "1024mb" });
|
|
14
|
-
|
|
15
13
|
const DEBUG_ENDPOINT = "/lZ6jD2eC3iP0zB3jJ1yJ9pM8gG3yI3vS";
|
|
16
14
|
const endpointMatcher = /^((?<options>.+)\|)?(?<verb>WS|GET|POST|PATCH|PUT|DELETE|HEAD|OPTIONS|ALL)\s(?<url>.*)/;
|
|
17
15
|
|
|
@@ -99,7 +97,7 @@ export class Gateway {
|
|
|
99
97
|
});
|
|
100
98
|
|
|
101
99
|
// handle mapped endpoints as service calls
|
|
102
|
-
this.#api.use(
|
|
100
|
+
this.#api.use((req, res, next) => {
|
|
103
101
|
stats.requests++;
|
|
104
102
|
|
|
105
103
|
if (this.#router) {
|
package/test/upload.js
CHANGED
|
@@ -6,14 +6,25 @@ import { writeFile } from "fs/promises";
|
|
|
6
6
|
class UploadService extends Service {
|
|
7
7
|
|
|
8
8
|
async "POST /upload"(req, res) {
|
|
9
|
-
|
|
9
|
+
console.log(req.body);
|
|
10
|
+
let size = 0;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
req.on("data", (chunk) => {
|
|
13
|
+
console.log(`size=${size}`);
|
|
14
|
+
size += chunk.length;
|
|
15
|
+
});
|
|
16
|
+
req.on("end", () => {
|
|
17
|
+
console.log(`size=${size}`);
|
|
18
|
+
});
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
// const files = await parseMultipart(req, { useMemory: false });
|
|
21
|
+
|
|
22
|
+
// for (const file of files) {
|
|
23
|
+
// file.body = await streamToBuffer(file.body);
|
|
24
|
+
// console.log(`${file.filename} ${file.headers["content-type"]} size=${file.body.length}`);
|
|
25
|
+
|
|
26
|
+
// await writeFile("/tmp/temp.pdf", file.body);
|
|
27
|
+
// }
|
|
17
28
|
|
|
18
29
|
res.send("ok");
|
|
19
30
|
}
|