MCPcopy
hub / github.com/mongodb/node-mongodb-native / stringToBuffer

Function stringToBuffer

src/cmap/auth/aws4.ts:83–87  ·  view source on GitHub ↗

* Returns a Uint8Array representation of a string, encoded in UTF-8. * @param str - String to convert. * @returns Uint8Array containing the UTF-8 encoded string.

(str: string)

Source from the content-addressed store, hash-verified

81 * @returns Uint8Array containing the UTF-8 encoded string.
82 */
83function stringToBuffer(str: string): Uint8Array {
84 const data = new Uint8Array(ByteUtils.utf8ByteLength(str));
85 ByteUtils.encodeUTF8Into(data, str, 0);
86 return data;
87}
88
89/**
90 * This method implements AWS Signature 4 logic for a very specific request format.

Callers 2

getHexSha256Function · 0.85
getHmacSha256Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected