file-details.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Objects with this prototype are used as the public representation of a file
  2. var path = require('path');
  3. var FileDetails = function (directoryEntry) {
  4. // TODO: Add 'extra field' support
  5. this._offset = 0;
  6. this._maxSize = 0;
  7. this.parent = path.dirname(directoryEntry.fileName);
  8. this.filename = path.basename(directoryEntry.fileName);
  9. this.path = path.normalize(directoryEntry.fileName);
  10. this.type = directoryEntry.fileAttributes.type;
  11. this.mode = directoryEntry.fileAttributes.mode;
  12. this.compressionMethod = directoryEntry.compressionMethod;
  13. this.modified = directoryEntry.modifiedTime;
  14. this.crc32 = directoryEntry.crc32;
  15. this.compressedSize = directoryEntry.compressedSize;
  16. this.uncompressedSize = directoryEntry.uncompressedSize;
  17. this.comment = directoryEntry.fileComment;
  18. this.flags = {
  19. encrypted: directoryEntry.generalPurposeFlags.encrypted,
  20. compressionFlag1: directoryEntry.generalPurposeFlags.compressionFlag1,
  21. compressionFlag2: directoryEntry.generalPurposeFlags.compressionFlag2,
  22. useDataDescriptor: directoryEntry.generalPurposeFlags.useDataDescriptor,
  23. enhancedDeflating: directoryEntry.generalPurposeFlags.enhancedDeflating,
  24. compressedPatched: directoryEntry.generalPurposeFlags.compressedPatched,
  25. strongEncryption: directoryEntry.generalPurposeFlags.strongEncryption,
  26. utf8: directoryEntry.generalPurposeFlags.utf8,
  27. encryptedCD: directoryEntry.generalPurposeFlags.encryptedCD
  28. };
  29. };
  30. module.exports = FileDetails;