Files
Shifted/node_modules/@mswjs/interceptors/lib/browser/bufferUtils-BiiO6HZv.mjs
2026-02-10 01:14:19 +00:00

20 lines
662 B
JavaScript

//#region src/utils/bufferUtils.ts
const encoder = new TextEncoder();
function encodeBuffer(text) {
return encoder.encode(text);
}
function decodeBuffer(buffer, encoding) {
return new TextDecoder(encoding).decode(buffer);
}
/**
* Create an `ArrayBuffer` from the given `Uint8Array`.
* Takes the byte offset into account to produce the right buffer
* in the case when the buffer is bigger than the data view.
*/
function toArrayBuffer(array) {
return array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength);
}
//#endregion
export { encodeBuffer as n, toArrayBuffer as r, decodeBuffer as t };
//# sourceMappingURL=bufferUtils-BiiO6HZv.mjs.map