Socket
Socket
Sign inDemoInstall

@aws-sdk/util-body-length-browser

Package Overview
Dependencies
1
Maintainers
7
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aws-sdk/util-body-length-browser

Determines the length of a request body in browsers


Version published
Maintainers
7
Created

Package description

What is @aws-sdk/util-body-length-browser?

The @aws-sdk/util-body-length-browser package is a utility module designed for use in browser environments to calculate the length of a request body. This is particularly useful when working with AWS SDK for JavaScript (v3) in browser environments, as it helps in determining the content length of various types of request bodies such as strings, binary data, and Blob objects. This functionality is crucial for correctly setting the Content-Length header in HTTP requests, which is often required by web services to process requests correctly.

What are @aws-sdk/util-body-length-browser's main functionalities?

Calculate string body length

This feature allows you to calculate the length of a string body. It's useful when you need to determine the size of a text-based request body before sending it in an HTTP request.

const { calculateBodyLength } = require('@aws-sdk/util-body-length-browser');
const bodyLength = calculateBodyLength('Hello World');
console.log(bodyLength);

Calculate Blob body length

This feature enables the calculation of the length of a Blob object's body. It's particularly useful for browser-based applications that need to send binary data or files as part of an HTTP request.

const { calculateBodyLength } = require('@aws-sdk/util-body-length-browser');
const blob = new Blob(['Hello World'], { type: 'text/plain' });
blob.arrayBuffer().then(buffer => {
  const bodyLength = calculateBodyLength(buffer);
  console.log(bodyLength);
});

Other packages similar to @aws-sdk/util-body-length-browser

Changelog

Source

3.35.0 (2021-10-04)

Bug Fixes

  • client-cognito-identity: import client from new location in src (#2858) (c8cb449)
  • client-documentation-generator: read files from src folder (#2863) (95c2903)
  • eslint SSDK protocol tests (#2854) (1e2a316)
  • client-s3: use member xmlname if applicable (#2835) (7e634cf)
  • scripts: overwrite test folder for protocol_tests (#2853) (5df7d12)
  • scripts: run downlevel-dts script in parallel (#2837) (0f8c0a2)

Features

  • clients: eslint --fix using esprint (#2849) (94d0a2d)
  • clients: move source files to 'src' folder (#2845) (e0025cd)
  • codegen: move source files to 'src' folder (#2844) (cfcdeb6)
  • scripts: use esprint to eslint --fix clients source code (#2846) (65922ea)

Readme

Source

@aws-sdk/util-body-length-browser

NPM version NPM downloads

Determines the length of a request body in browsers

An internal package

Usage

You probably shouldn't, at least directly.

FAQs

Last updated on 04 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc