JSPM

@aws-sdk/util-user-agent-browser

3.930.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 41462425
  • Score
    100M100P100Q372355F
  • License Apache-2.0

Package Exports

  • @aws-sdk/util-user-agent-browser
  • @aws-sdk/util-user-agent-browser/dist-cjs/index.js
  • @aws-sdk/util-user-agent-browser/dist-es/index.js
  • @aws-sdk/util-user-agent-browser/dist-es/index.native.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@aws-sdk/util-user-agent-browser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@aws-sdk/util-user-agent-browser

NPM version NPM downloads

Usage

In previous versions of the AWS SDK for JavaScript v3, the AWS SDK user agent header was provided by parsing the navigator user agent string with the bowser library.

This was later changed to browser feature detection using the native Navigator APIs, but if you would like to have the previous functionality, use the following code:

import { createUserAgentStringParsingProvider } from "@aws-sdk/util-user-agent-browser";

import { S3Client } from "@aws-sdk/client-s3";
import pkgInfo from "@aws-sdk/client-s3/package.json";
// or any other client.

const client = new S3Client({
  defaultUserAgentProvider: createUserAgentStringParsingProvider({
    // For a client's serviceId, check the corresponding shared runtimeConfig file
    // https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-s3/src/runtimeConfig.shared.ts
    serviceId: "S3",
    clientVersion: pkgInfo.version,
  }),
});

This usage is not recommended, due to the size of the additional parsing library.