fix(Cache): Use TextEncoder to encode compressed data

This commit is contained in:
Luan
2024-06-05 12:30:12 -03:00
parent b588554ce1
commit 384b80ee41
2 changed files with 5 additions and 3 deletions

View File

@@ -392,7 +392,7 @@ export default class Session extends EventEmitter {
Log.info(TAG, 'Compressing and caching session data.');
const compressed_session_data = Buffer.from(LZW.compress(JSON.stringify(session_data)));
const compressed_session_data = new TextEncoder().encode(LZW.compress(JSON.stringify(session_data)));
const buffer = new ArrayBuffer(4 + compressed_session_data.byteLength);
new DataView(buffer).setUint32(0, compressed_session_data.byteLength, true); // (Luan) XX: Leave this here for debugging purposes