@mjackson/node-fetch-server
Advanced tools
@@ -30,2 +30,12 @@ "use strict"; | ||
| // src/lib/read-stream.ts | ||
| async function* readStream(stream) { | ||
| let reader = stream.getReader(); | ||
| while (true) { | ||
| const { done, value } = await reader.read(); | ||
| if (done) break; | ||
| yield value; | ||
| } | ||
| } | ||
| // src/lib/request-listener.ts | ||
@@ -142,3 +152,3 @@ function createRequestListener(handler, options) { | ||
| if (response.body != null && res.req.method !== "HEAD") { | ||
| for await (let chunk of response.body) { | ||
| for await (let chunk of readStream(response.body)) { | ||
| res.write(chunk); | ||
@@ -145,0 +155,0 @@ } |
@@ -0,1 +1,11 @@ | ||
| // src/lib/read-stream.ts | ||
| async function* readStream(stream) { | ||
| let reader = stream.getReader(); | ||
| while (true) { | ||
| const { done, value } = await reader.read(); | ||
| if (done) break; | ||
| yield value; | ||
| } | ||
| } | ||
| // src/lib/request-listener.ts | ||
@@ -112,3 +122,3 @@ function createRequestListener(handler, options) { | ||
| if (response.body != null && res.req.method !== "HEAD") { | ||
| for await (let chunk of response.body) { | ||
| for await (let chunk of readStream(response.body)) { | ||
| res.write(chunk); | ||
@@ -115,0 +125,0 @@ } |
+8
-9
| { | ||
| "name": "@mjackson/node-fetch-server", | ||
| "version": "0.5.0", | ||
| "version": "0.5.1", | ||
| "description": "Build servers for Node.js using the web fetch API", | ||
@@ -46,8 +46,2 @@ "author": "Michael Jackson <mjijackson@gmail.com>", | ||
| }, | ||
| "scripts": { | ||
| "bench": "bash ./bench/runner.sh", | ||
| "build": "tsup", | ||
| "test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts", | ||
| "prepare": "pnpm run build" | ||
| }, | ||
| "keywords": [ | ||
@@ -60,3 +54,8 @@ "http", | ||
| "web" | ||
| ] | ||
| } | ||
| ], | ||
| "scripts": { | ||
| "bench": "bash ./bench/runner.sh", | ||
| "build": "tsup", | ||
| "test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test ./src/**/*.test.ts" | ||
| } | ||
| } |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
26049
1.59%413
4.56%