Rocky_Mountain_Vending/.pnpm-store/v10/files/5e/27dd727a5dcbebda41e0d10c25c9e1cdd7b6ed13d2e03c8642cfc13fd0b4ef11d44946d9994b0d40294c920747ab3a0ab023e2214add199f19142cc19e2515
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

27 lines
835 B
Text

import { fstatSync, lstatSync, ReadStream } from "node:fs";
export const calculateBodyLength = (body) => {
if (!body) {
return 0;
}
if (typeof body === "string") {
return Buffer.byteLength(body);
}
else if (typeof body.byteLength === "number") {
return body.byteLength;
}
else if (typeof body.size === "number") {
return body.size;
}
else if (typeof body.start === "number" && typeof body.end === "number") {
return body.end + 1 - body.start;
}
else if (body instanceof ReadStream) {
if (body.path != null) {
return lstatSync(body.path).size;
}
else if (typeof body.fd === "number") {
return fstatSync(body.fd).size;
}
}
throw new Error(`Body Length computation failed for ${body}`);
};