How to use @aws-sdk/util-utf8-node - 3 common examples

To help you get started, we’ve selected a few @aws-sdk/util-utf8-node 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 / sha256-tree-hash / src / index.spec.ts View on Github external
it("computes tree hashes of Uint8Array bodies < 1 MB", async () => {
    const treeHash = new TreeHash(Sha256, fromUtf8);
    treeHash.update(fromUtf8("bar"));
    const results = await treeHash.digest();
    expect(toHex(results)).toEqual(
      "fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9"
    );
  });
github aws / aws-sdk-js-v3 / packages / util-utf8-universal / src / index.ts View on Github external
export function fromUtf8(input: string): Uint8Array {
  if (isNode()) {
    return nodeFromUtf8(input);
  }

  return browserFromUtf8(input);
}
github aws / aws-sdk-js-v3 / packages / util-utf8-universal / src / index.ts View on Github external
export function toUtf8(input: Uint8Array): string {
  if (isNode()) {
    return nodeToUtf8(input);
  }

  return browserToUtf8(input);
}

@aws-sdk/util-utf8-node

A Node.JS UTF-8 string <-> UInt8Array converter

Apache-2.0
Latest version published 2 years ago

Package Health Score

93 / 100
Full package analysis

Popular @aws-sdk/util-utf8-node functions

Similar packages