Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@smithy/util-body-length-node

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/util-body-length-node - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

30

dist-cjs/calculateBodyLength.js

@@ -1,29 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateBodyLength = void 0;
const fs_1 = require("fs");
const calculateBodyLength = (body) => {
if (!body) {
return 0;
}
if (typeof body === "string") {
return Buffer.from(body).length;
}
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 (typeof body.path === "string" || Buffer.isBuffer(body.path)) {
return (0, fs_1.lstatSync)(body.path).size;
}
else if (typeof body.fd === "number") {
return (0, fs_1.fstatSync)(body.fd).size;
}
throw new Error(`Body Length computation failed for ${body}`);
};
exports.calculateBodyLength = calculateBodyLength;
module.exports = require("./index.js");

55

dist-cjs/index.js

@@ -1,4 +0,51 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./calculateBodyLength"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
calculateBodyLength: () => calculateBodyLength
});
module.exports = __toCommonJS(src_exports);
// src/calculateBodyLength.ts
var import_fs = require("fs");
var calculateBodyLength = /* @__PURE__ */ __name((body) => {
if (!body) {
return 0;
}
if (typeof body === "string") {
return Buffer.from(body).length;
} 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 (typeof body.path === "string" || Buffer.isBuffer(body.path)) {
return (0, import_fs.lstatSync)(body.path).size;
} else if (typeof body.fd === "number") {
return (0, import_fs.fstatSync)(body.fd).size;
}
throw new Error(`Body Length computation failed for ${body}`);
}, "calculateBodyLength");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
calculateBodyLength
});
{
"name": "@smithy/util-body-length-node",
"description": "Determines the length of a request body in node.js",
"version": "2.1.0",
"version": "2.2.0",
"scripts": {
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:es": "tsc -p tsconfig.es.json",
"build:types": "tsc -p tsconfig.types.json",
"build:cjs": "node ../../scripts/inline util-body-length-node",
"build:es": "yarn g:tsc -p tsconfig.es.json",
"build:types": "yarn g:tsc -p tsconfig.types.json",
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
"stage-release": "rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
"format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"",
"test": "jest"
"test": "yarn g:jest"
},

@@ -22,6 +22,4 @@ "devDependencies": {

"downlevel-dts": "0.10.1",
"jest": "28.1.1",
"rimraf": "3.0.2",
"typedoc": "0.23.23",
"typescript": "~4.9.5"
"typedoc": "0.23.23"
},

@@ -28,0 +26,0 @@ "main": "./dist-cjs/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc