mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-18 17:23:16 +00:00
Added UTF8 support to zip reader/writer
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -377,10 +377,19 @@ function read(path)
|
|||||||
var efLength = buffer.readUInt16LE(30);
|
var efLength = buffer.readUInt16LE(30);
|
||||||
var comLength = buffer.readUInt16LE(32);
|
var comLength = buffer.readUInt16LE(32);
|
||||||
var name = buffer.slice(46, 46 + nameLength).toString();
|
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('Central Directory Record:');
|
||||||
console.info1(' Version: ' + buffer.readUInt16LE(4));
|
console.info1(' Version: ' + buffer.readUInt16LE(4));
|
||||||
console.info1(' Minimum: ' + buffer.readUInt16LE(6));
|
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(' Name: ' + name);
|
||||||
console.info1(' CRC-32 of Uncompressed data: ' + buffer.readUInt32LE(16));
|
console.info1(' CRC-32 of Uncompressed data: ' + buffer.readUInt32LE(16));
|
||||||
console.info1(' Uncompressed Size: ' + buffer.readUInt32LE(24));
|
console.info1(' Uncompressed Size: ' + buffer.readUInt32LE(24));
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ function finished(options)
|
|||||||
CD.writeUInt32LE(CDR, 0); // Signature
|
CD.writeUInt32LE(CDR, 0); // Signature
|
||||||
CD.writeUInt16LE(20, 4); // Version
|
CD.writeUInt16LE(20, 4); // Version
|
||||||
CD.writeUInt16LE(20, 6); // Minimum
|
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(8, 10); // Compression Method
|
||||||
|
|
||||||
CD.writeUInt16LE(namelen, 28); // File Name Length
|
CD.writeUInt16LE(namelen, 28); // File Name Length
|
||||||
@@ -169,7 +169,7 @@ function next(options)
|
|||||||
this._header = Buffer.alloc(30 + nameBuffer.length);
|
this._header = Buffer.alloc(30 + nameBuffer.length);
|
||||||
|
|
||||||
this._header.writeUInt32LE(LFR, 0); // Signature
|
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(8, 8); // Compression Method
|
||||||
|
|
||||||
this._header.writeUInt16LE(this._timestamp.time, 10); // File Last Modification Time
|
this._header.writeUInt16LE(this._timestamp.time, 10); // File Last Modification Time
|
||||||
|
|||||||
Reference in New Issue
Block a user