@typespec/ts-http-runtime
Version:
Isomorphic client library for making HTTP requests in node.js and browser.
21 lines • 753 B
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* The helper that transforms bytes with specific character encoding into string
* @param bytes - the uint8array bytes
* @param format - the format we use to encode the byte
* @returns a string of the encoded string
*/
export function uint8ArrayToString(bytes, format) {
return Buffer.from(bytes).toString(format);
}
/**
* The helper that transforms string to specific character encoded bytes array.
* @param value - the string to be converted
* @param format - the format we use to decode the value
* @returns a uint8array
*/
export function stringToUint8Array(value, format) {
return Buffer.from(value, format);
}
//# sourceMappingURL=bytesEncoding.js.map