You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@hono/node-server

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hono/node-server - npm Package Compare versions

Comparing version
1.19.5
to
1.19.6
+21
-19
dist/serve-static.js

@@ -101,3 +101,2 @@ "use strict";

}
await options.onFound?.(path, c);
const mimeType = (0, import_mime.getMimeType)(path);

@@ -123,26 +122,29 @@ c.header("Content-Type", mimeType || "application/octet-stream");

}
let result;
const size = stats.size;
const range = c.req.header("range") || "";
if (c.req.method == "HEAD" || c.req.method == "OPTIONS") {
c.header("Content-Length", size.toString());
c.status(200);
return c.body(null);
}
const range = c.req.header("range") || "";
if (!range) {
result = c.body(null);
} else if (!range) {
c.header("Content-Length", size.toString());
return c.body(createStreamBody((0, import_node_fs.createReadStream)(path)), 200);
result = c.body(createStreamBody((0, import_node_fs.createReadStream)(path)), 200);
} else {
c.header("Accept-Ranges", "bytes");
c.header("Date", stats.birthtime.toUTCString());
const parts = range.replace(/bytes=/, "").split("-", 2);
const start = parseInt(parts[0], 10) || 0;
let end = parseInt(parts[1], 10) || size - 1;
if (size < end - start + 1) {
end = size - 1;
}
const chunksize = end - start + 1;
const stream = (0, import_node_fs.createReadStream)(path, { start, end });
c.header("Content-Length", chunksize.toString());
c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
result = c.body(createStreamBody(stream), 206);
}
c.header("Accept-Ranges", "bytes");
c.header("Date", stats.birthtime.toUTCString());
const parts = range.replace(/bytes=/, "").split("-", 2);
const start = parseInt(parts[0], 10) || 0;
let end = parseInt(parts[1], 10) || size - 1;
if (size < end - start + 1) {
end = size - 1;
}
const chunksize = end - start + 1;
const stream = (0, import_node_fs.createReadStream)(path, { start, end });
c.header("Content-Length", chunksize.toString());
c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
return c.body(createStreamBody(stream), 206);
await options.onFound?.(path, c);
return result;
};

@@ -149,0 +151,0 @@ };

@@ -77,3 +77,2 @@ // src/serve-static.ts

}
await options.onFound?.(path, c);
const mimeType = getMimeType(path);

@@ -99,26 +98,29 @@ c.header("Content-Type", mimeType || "application/octet-stream");

}
let result;
const size = stats.size;
const range = c.req.header("range") || "";
if (c.req.method == "HEAD" || c.req.method == "OPTIONS") {
c.header("Content-Length", size.toString());
c.status(200);
return c.body(null);
}
const range = c.req.header("range") || "";
if (!range) {
result = c.body(null);
} else if (!range) {
c.header("Content-Length", size.toString());
return c.body(createStreamBody(createReadStream(path)), 200);
result = c.body(createStreamBody(createReadStream(path)), 200);
} else {
c.header("Accept-Ranges", "bytes");
c.header("Date", stats.birthtime.toUTCString());
const parts = range.replace(/bytes=/, "").split("-", 2);
const start = parseInt(parts[0], 10) || 0;
let end = parseInt(parts[1], 10) || size - 1;
if (size < end - start + 1) {
end = size - 1;
}
const chunksize = end - start + 1;
const stream = createReadStream(path, { start, end });
c.header("Content-Length", chunksize.toString());
c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
result = c.body(createStreamBody(stream), 206);
}
c.header("Accept-Ranges", "bytes");
c.header("Date", stats.birthtime.toUTCString());
const parts = range.replace(/bytes=/, "").split("-", 2);
const start = parseInt(parts[0], 10) || 0;
let end = parseInt(parts[1], 10) || size - 1;
if (size < end - start + 1) {
end = size - 1;
}
const chunksize = end - start + 1;
const stream = createReadStream(path, { start, end });
c.header("Content-Length", chunksize.toString());
c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
return c.body(createStreamBody(stream), 206);
await options.onFound?.(path, c);
return result;
};

@@ -125,0 +127,0 @@ };

{
"name": "@hono/node-server",
"version": "1.19.5",
"version": "1.19.6",
"description": "Node.js Adapter for Hono",

@@ -5,0 +5,0 @@ "main": "dist/index.js",