Options
All
  • Public
  • Public/Protected
  • All
Menu

aws-crt

Index

Functions

aws_sign_request

  • Perform AWS HTTP request signing.

    The HttpRequest is transformed asynchronously, according to the AwsSigningConfig.

    When signing:

    1. It is good practice to use a new config for each signature, or the date might get too old.

    2. Do not add the following headers to requests before signing, they may be added by the signer: x-amz-content-sha256, X-Amz-Date, Authorization

    3. Do not add the following query params to requests before signing, they may be added by the signer: X-Amz-Signature, X-Amz-Date, X-Amz-Credential, X-Amz-Algorithm, X-Amz-SignedHeaders

    Parameters

    Returns Promise<HttpRequest>

    A Future whose result will be the signed HttpRequest. The future will contain an exception if the signing process fails.

crt_version

  • crt_version(): any
  • Returns the AWS CRT version

    Returns any

enable_logging

  • Enables logging of the native AWS CRT libraries.

    Parameters

    • level: LogLevel

      The logging level to filter to. It is not possible to log less than WARN.

      nodejs only.

    Returns void

hash_md5

  • hash_md5(data: Hashable, truncate_to?: number): DataView
  • Computes an MD5 hash. Use this if you don't need to stream the data you're hashing and can load the entire input into memory.

    Parameters

    • data: Hashable

      The data to hash

    • Optional truncate_to: number

      The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.

    Returns DataView

hash_sha256

  • hash_sha256(data: Hashable, truncate_to?: number): DataView
  • Computes an SHA256 hash. Use this if you don't need to stream the data you're hashing and can load the entire input into memory.

    Parameters

    • data: Hashable

      The data to hash

    • Optional truncate_to: number

      The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.

    Returns DataView

hmac_sha256

  • Computes an SHA256 HMAC. Use this if you don't need to stream the data you're hashing and can load the entire input into memory.

    Parameters

    • secret: Hashable

      The key to use for the HMAC process

    • data: Hashable

      The data to hash

    • Optional truncate_to: number

      The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.

    Returns DataView

is_alpn_available

  • is_alpn_available(): boolean
  • Returns true if ALPN is available on this platform natively

    Returns boolean

    true if ALPN is supported natively, false otherwise

    nodejs only.

is_browser

  • is_browser(): boolean
  • Returns true if this script is running in a browser

    Returns boolean

is_nodejs

  • is_nodejs(): boolean
  • Returns true if this script is running under nodejs

    Returns boolean

native_memory

  • native_memory(): number
  • If the AWS_CRT_MEMORY_TRACING is environment variable is set to 1 or 2, will return the native memory usage in bytes. Otherwise, returns 0.

    Returns number

    The total allocated native memory, in bytes.

native_memory_dump

  • native_memory_dump(): void
  • Dumps outstanding native memory allocations. If the AWS_CRT_MEMORY_TRACING environment variable is set to 1 or 2, will dump all active native memory to the console log.

    Returns void

package_info

  • package_info(): any
  • Returns the package information for aws-crt-nodejs

    Returns any

using

  • using<T>(resource: T, func: (resource: T) => void): Promise<void>
  • Use this function to create a resource in an async context. This will make sure the resources are cleaned up before returning.

    Example:

    await using(res = new SomeResource(), async (res) =>  {
        res.do_the_thing();
    });

    Type parameters

    Parameters

    • resource: T
    • func: (resource: T) => void
        • (resource: T): void
        • Parameters

          • resource: T

          Returns void

    Returns Promise<void>

Type aliases

AwsSigningConfig

AwsSigningConfig: AwsSigningConfig

Configuration for use in AWS-related signing. AwsSigningConfig is immutable. It is good practice to use a new config for each signature, or the date might get too old.

Hashable

Hashable: string | ArrayBuffer | DataView | Buffer

The types that are acceptable to use as input for hashing.

HttpHeader

HttpHeader: [string, string]

Headers are exposed as 2 element arrays: [name, value]

Payload

Payload: String | Object | DataView

Possible types of data to send via publish or receive via subscription

Generated using TypeDoc