mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 22:17:31 +03:00
Fixed agent compression on NodeJS v16.
This commit is contained in:
parent
fae1101123
commit
fddf037bb1
@ -2671,7 +2671,15 @@ function CreateMeshCentralServer(config, args) {
|
||||
archive.on('data', onZipData);
|
||||
archive.on('end', onZipEnd);
|
||||
archive.on('error', onZipError);
|
||||
archive.append(this.meshAgentBinary.data, { name: 'meshagent' });
|
||||
|
||||
// Starting with NodeJS v16, passing in a buffer at archive.append() will result a compressed file with zero byte length. To fix this, we pass in the buffer as a stream.
|
||||
// archive.append(this.meshAgentBinary.data, { name: 'meshagent' }); // This is the version that does not work on NodeJS v16.
|
||||
const ReadableStream = require('stream').Readable;
|
||||
const zipInputStream = new ReadableStream();
|
||||
zipInputStream.push(this.meshAgentBinary.data);
|
||||
zipInputStream.push(null);
|
||||
archive.append(zipInputStream, { name: 'meshagent' });
|
||||
|
||||
archive.finalize();
|
||||
})
|
||||
obj.exeHandler.streamExeWithMeshPolicy(
|
||||
|
Loading…
Reference in New Issue
Block a user