Files
Vlad Durnea cffdf8af86
Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped
wip:milestone 0 fixes
2026-03-15 12:35:42 +02:00

38 lines
965 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
Object.defineProperty(exports, 'decodeBuffer', {
enumerable: true,
get: function () {
return decodeBuffer;
}
});
Object.defineProperty(exports, 'encodeBuffer', {
enumerable: true,
get: function () {
return encodeBuffer;
}
});
Object.defineProperty(exports, 'toArrayBuffer', {
enumerable: true,
get: function () {
return toArrayBuffer;
}
});
//# sourceMappingURL=bufferUtils-DiCTqG-7.cjs.map