template-saas/apps/backend/node_modules/@smithy/util-body-length-node/dist-cjs/index.js
rckrdmrd 50a821a415
Some checks failed
CI / Backend CI (push) Has been cancelled
CI / Frontend CI (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / CI Summary (push) Has been cancelled
[SIMCO-V38] feat: Actualizar a SIMCO v3.8.0
- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8
- Actualizaciones de configuracion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:53:08 -06:00

33 lines
894 B
JavaScript

'use strict';
var node_fs = require('node:fs');
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 node_fs.ReadStream) {
if (body.path != null) {
return node_fs.lstatSync(body.path).size;
}
else if (typeof body.fd === "number") {
return node_fs.fstatSync(body.fd).size;
}
}
throw new Error(`Body Length computation failed for ${body}`);
};
exports.calculateBodyLength = calculateBodyLength;