New:Socket for Asana Is Now Available.Learn more
Sign In

@arcjet/body

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcjet/body - npm Package Compare versions

Comparing version
1.9.1
to
1.10.0-rc.0
+31
-31
dist/index.d.ts
//#region src/index.d.ts
/**
* Configuration.
*/
* Configuration.
*/
type ReadBodyOpts = {
/**
* Length of the stream in bytes (optional);
* rejects an error if the contents of the stream do not add up to this length;
* useful when the exact size is known.
*/
* Length of the stream in bytes (optional);
* rejects an error if the contents of the stream do not add up to this length;
* useful when the exact size is known.
*/
expectedLength?: number | null | undefined;
/**
* Limit of the body in bytes (default: `1048576`);
* an error is returned if the body ends up being larger than this limit;
* used to prevent reading too much data from malicious clients.
*/
* Limit of the body in bytes (default: `1048576`);
* an error is returned if the body ends up being larger than this limit;
* used to prevent reading too much data from malicious clients.
*/
limit?: number | null | undefined;

@@ -21,4 +21,4 @@ };

/**
* Minimal Node.js stream interface.
*/
* Minimal Node.js stream interface.
*/
interface ReadableStreamLike {

@@ -30,25 +30,25 @@ on?: EventHandlerLike | null | undefined;

/**
* Read the body of a
* [web stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
*
* @param stream
* Stream.
* @param options
* Configuration (required).
* @returns
* Promise that resolves to a concatenated body.
*/
* Read the body of a
* [web stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
*
* @param stream
* Stream.
* @param options
* Configuration (required).
* @returns
* Promise that resolves to a concatenated body.
*/
declare function readBodyWeb(stream: ReadableStream, options?: ReadBodyOpts | null | undefined): Promise<string>;
/**
* Read the body of a Node.js stream.
*
* @param stream
* Stream.
* @param options
* Configuration (optional).
* @returns
* Promise that resolves to a concatenated body.
*/
* Read the body of a Node.js stream.
*
* @param stream
* Stream.
* @param options
* Configuration (optional).
* @returns
* Promise that resolves to a concatenated body.
*/
declare function readBody(stream: ReadableStreamLike, options?: ReadBodyOpts | null | undefined): Promise<string>;
//#endregion
export { ReadBodyOpts, ReadableStreamLike, readBody, readBodyWeb };
{
"name": "@arcjet/body",
"version": "1.9.1",
"version": "1.10.0-rc.0",
"description": "Arcjet utilities for extracting the body from a stream",

@@ -46,3 +46,3 @@ "keywords": [

"build": "tsdown",
"typecheck": "tsgo --noEmit",
"typecheck": "tsc --noEmit",
"pretest": "npm run build",

@@ -55,5 +55,5 @@ "test-api": "node --test -- test/*.test.ts",

"devDependencies": {
"@types/node": "22.19.21",
"tsdown": "0.22.3",
"typescript": "6.0.3"
"@types/node": "22.20.1",
"tsdown": "0.22.7",
"typescript": "7.0.2"
},

@@ -60,0 +60,0 @@ "engines": {