How to use the @aws-sdk/util-utf8-browser.fromUtf8 function in @aws-sdk/util-utf8-browser

To help you get started, we’ve selected a few @aws-sdk/util-utf8-browser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-sdk-js-v3 / packages / crypto-sha256-browser / src / webCryptoSha256.ts View on Github external
function convertToBuffer(data: SourceData): Uint8Array {
    if (typeof data === 'string') {
        return fromUtf8(data);
    }

    if (ArrayBuffer.isView(data)) {
        return new Uint8Array(
            data.buffer,
            data.byteOffset,
            data.byteLength / Uint8Array.BYTES_PER_ELEMENT
        );
    }

    return new Uint8Array(data);
}
github aws / aws-sdk-js-v3 / packages / crypto-sha256-browser / src / ie11Sha256.ts View on Github external
function toArrayBufferView(data: SourceData): Uint8Array {
    if (typeof data === 'string') {
        return fromUtf8(data);
    }

    if (ArrayBuffer.isView(data)) {
        return new Uint8Array(
            data.buffer,
            data.byteOffset,
            data.byteLength / Uint8Array.BYTES_PER_ELEMENT
        );
    }

    return new Uint8Array(data);
}
github aws / aws-sdk-js-v3 / packages / crypto-sha256-js / src / jsSha256.ts View on Github external
function convertToBuffer(data: SourceData): Uint8Array {
    if (typeof data === 'string') {
        return fromUtf8(data);
    }

    if (ArrayBuffer.isView(data)) {
        return new Uint8Array(
            data.buffer,
            data.byteOffset,
            data.byteLength / Uint8Array.BYTES_PER_ELEMENT
        );
    }

    return new Uint8Array(data);
}
github aws / aws-sdk-js-v3 / packages / md5-js / src / index.ts View on Github external
function convertToBuffer(data: SourceData): Uint8Array {
  if (typeof data === "string") {
    return fromUtf8(data);
  }

  if (ArrayBuffer.isView(data)) {
    return new Uint8Array(
      data.buffer,
      data.byteOffset,
      data.byteLength / Uint8Array.BYTES_PER_ELEMENT
    );
  }

  return new Uint8Array(data);
}

@aws-sdk/util-utf8-browser

A browser UTF-8 string <-> UInt8Array converter

Apache-2.0
Latest version published 2 years ago

Package Health Score

91 / 100
Full package analysis

Similar packages