1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-06 00:13:33 +00:00

Added UTF8 support to zip reader/writer

This commit is contained in:
Bryan Roe
2022-02-01 20:14:29 -08:00
parent 47b99608cf
commit 11d13ce251
3 changed files with 13 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -377,10 +377,19 @@ function read(path)
var efLength = buffer.readUInt16LE(30);
var comLength = buffer.readUInt16LE(32);
var name = buffer.slice(46, 46 + nameLength).toString();
var namebuf = buffer.slice(46, 46 + nameLength);
var efs = (buffer.readUInt16LE(8) & 2048) == 2048;
console.info1('Central Directory Record:');
console.info1(' Version: ' + buffer.readUInt16LE(4));
console.info1(' Minimum: ' + buffer.readUInt16LE(6));
console.info1(' General Purpose Flags: ' + buffer.readUInt16LE(8));
console.info1(' EFS: ' + efs);
if (efs)
{
console.info1(' => ' + namebuf.toString('hex'));
console.info1(' E6B8ACE8A9A6E69687E4BBB62E6C6F67');
}
console.info1(' Name: ' + name);
console.info1(' CRC-32 of Uncompressed data: ' + buffer.readUInt32LE(16));
console.info1(' Uncompressed Size: ' + buffer.readUInt32LE(24));

View File

@@ -121,7 +121,7 @@ function finished(options)
CD.writeUInt32LE(CDR, 0); // Signature
CD.writeUInt16LE(20, 4); // Version
CD.writeUInt16LE(20, 6); // Minimum
CD.writeUInt16LE(0x08, 8); // General Purpose Bit Flag
CD.writeUInt16LE(0x08 | 2048, 8); // General Purpose Bit Flag
CD.writeUInt16LE(8, 10); // Compression Method
CD.writeUInt16LE(namelen, 28); // File Name Length
@@ -169,7 +169,7 @@ function next(options)
this._header = Buffer.alloc(30 + nameBuffer.length);
this._header.writeUInt32LE(LFR, 0); // Signature
this._header.writeUInt16LE(0x08, 6); // General Purpose Bit Flag
this._header.writeUInt16LE(0x08 | 2048, 6); // General Purpose Bit Flag
this._header.writeUInt16LE(8, 8); // Compression Method
this._header.writeUInt16LE(this._timestamp.time, 10); // File Last Modification Time