mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	Fixed agent compression on NodeJS v16.
This commit is contained in:
		
							parent
							
								
									fae1101123
								
							
						
					
					
						commit
						fddf037bb1
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		|  | @ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue