
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@aws-sdk/xhr-http-handler
Advanced tools
This HttpHandler is based on XMLHttpRequest and can be substituted if
requiring a specific use case not covered by fetch.
The recommended HttpHandler for browser-like environments is @smithy/fetch-http-handler,
which is the default.
This alternative has only been tested against S3 in browsers.
The following global-scope implementations are accessed by this package:
XMLHttpRequestTextEncoderTransformStreamBlobYou will have to supply polyfills, for example for TextEncoder and TransformStream, for environments
that do not implement them natively.
Use the Upload class from the @aws-sdk/lib-storage package as normal, except supplying a different
HttpHandler when creating the S3Client or S3 object(s).
See also: lib-storage/README.md.
import { XhrHttpHandler } from "@aws-sdk/xhr-http-handler";
import { S3Client } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";
const client = new S3Client({
requestHandler: new XhrHttpHandler({}), // overrides default FetchHttpHandler in browsers.
});
const upload = new Upload({
client,
params: {
/* ... */
},
});
upload.on("httpUploadProgress", (progress) => {
// Note, this event will be emitted much more frequently when using the XhrHttpHandler.
// Your application should be ready to throttle the event listener if it is
// computationally expensive.
// The default FetchHttpHandler only emits this event upon the completion of each
// part, a minimum of 5 MB. Using XHR will emit this event continuously, including
// for files smaller than the chunk size, which use single-part upload.
console.log(progress);
console.log(
progress.loaded, // Bytes uploaded so far.
progress.total // Total bytes. Divide these two for progress percentage.
);
});
const completeMultiPartUpload = await upload.done();
XhrHttpHandler extends EventEmitter.
import { XhrHttpHandler } from "@aws-sdk/xhr-http-handler";
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
const handler = new XhrHttpHandler({});
handler.on(XhrHttpHandler.EVENTS.PROGRESS, (progress, request) => {
if (progress.lengthComputable) {
console.log(
progress.loaded, // bytes
progress.total // bytes
);
console.log(
request // contains the request information to differentiate
// requests from the same handler.
);
}
});
const client = new S3Client({
requestHandler: handler,
});
await client.send(new GetObjectCommand(/*...*/));
XMLHttpRequest object.You can access the XMLHttpRequest object to inspect it or to
attach addiional event listeners.
import { XhrHttpHandler } from "@aws-sdk/xhr-http-handler";
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
const handler = new XhrHttpHandler({});
handler.on(XhrHttpHandler.EVENTS.XHR_INSTANTIATED, (xhr) => {
// a new XMLHttpRequest is created for each command sent.
// this is immediately after instantiation.
});
handler.on(XhrHttpHandler.EVENTS.BEFORE_XHR_SEND, (xhr) => {
// a new XMLHttpRequest is created for each command sent.
// this is immediately before calling `xhr.send(body)`.
});
const client = new S3Client({
requestHandler: handler,
});
await client.send(new GetObjectCommand(/*...*/));
You can check the source .ts file or published .d.ts file
for the full list of events, or inspect the XhrHttpHandler.EVENTS
object at runtime.
3.890.0 (2025-09-16)
FAQs
Provides a way to make requests using XMLHttpRequest
The npm package @aws-sdk/xhr-http-handler receives a total of 9,636 weekly downloads. As such, @aws-sdk/xhr-http-handler popularity was classified as popular.
We found that @aws-sdk/xhr-http-handler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
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.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.