compress-commons
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -71,2 +71,2 @@ /** | ||
S_DOS_R: 1 // 01 Read Only | ||
}; | ||
}; |
@@ -13,2 +13,3 @@ /** | ||
var GeneralPurposeBit = require('./general-purpose-bit'); | ||
var UnixStat = require('./unix-stat'); | ||
@@ -49,2 +50,7 @@ var constants = require('./constants'); | ||
/** | ||
* Returns the extra fields related to the entry. | ||
* | ||
* @returns {Buffer} | ||
*/ | ||
ZipArchiveEntry.prototype.getCentralDirectoryExtra = function() { | ||
@@ -54,2 +60,7 @@ return this.getExtra(); | ||
/** | ||
* Returns the comment set for the entry. | ||
* | ||
* @returns {string} | ||
*/ | ||
ZipArchiveEntry.prototype.getComment = function() { | ||
@@ -59,2 +70,7 @@ return this.comment !== null ? this.comment : ''; | ||
/** | ||
* Returns the compressed size of the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getCompressedSize = function() { | ||
@@ -64,2 +80,7 @@ return this.csize; | ||
/** | ||
* Returns the CRC32 digest for the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getCrc = function() { | ||
@@ -69,2 +90,7 @@ return this.crc; | ||
/** | ||
* Returns the external file attributes for the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getExternalAttributes = function() { | ||
@@ -74,2 +100,7 @@ return this.exattr; | ||
/** | ||
* Returns the extra fields related to the entry. | ||
* | ||
* @returns {Buffer} | ||
*/ | ||
ZipArchiveEntry.prototype.getExtra = function() { | ||
@@ -79,2 +110,7 @@ return this.extra !== null ? this.extra : constants.EMPTY; | ||
/** | ||
* Returns the general purpose bits related to the entry. | ||
* | ||
* @returns {GeneralPurposeBit} | ||
*/ | ||
ZipArchiveEntry.prototype.getGeneralPurposeBit = function() { | ||
@@ -84,2 +120,7 @@ return this.gpb; | ||
/** | ||
* Returns the internal file attributes for the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getInternalAttributes = function() { | ||
@@ -89,2 +130,7 @@ return this.inattr; | ||
/** | ||
* Returns the last modified date of the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getLastModifiedDate = function() { | ||
@@ -94,2 +140,7 @@ return this.getTime(); | ||
/** | ||
* Returns the extra fields related to the entry. | ||
* | ||
* @returns {Buffer} | ||
*/ | ||
ZipArchiveEntry.prototype.getLocalFileDataExtra = function() { | ||
@@ -99,2 +150,7 @@ return this.getExtra(); | ||
/** | ||
* Returns the compression method used on the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getMethod = function() { | ||
@@ -104,2 +160,7 @@ return this.method; | ||
/** | ||
* Returns the filename of the entry. | ||
* | ||
* @returns {string} | ||
*/ | ||
ZipArchiveEntry.prototype.getName = function() { | ||
@@ -109,2 +170,7 @@ return this.name; | ||
/** | ||
* Returns the platform on which the entry was made. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getPlatform = function() { | ||
@@ -114,2 +180,7 @@ return this.platform; | ||
/** | ||
* Returns the size of the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getSize = function() { | ||
@@ -119,2 +190,7 @@ return this.size; | ||
/** | ||
* Returns a date object representing the last modified date of the entry. | ||
* | ||
* @returns {number|Date} | ||
*/ | ||
ZipArchiveEntry.prototype.getTime = function() { | ||
@@ -124,2 +200,7 @@ return this.time !== -1 ? zipUtil.dosToDate(this.time) : -1; | ||
/** | ||
* Returns the DOS timestamp for the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getTimeDos = function() { | ||
@@ -129,6 +210,16 @@ return this.time !== -1 ? this.time : 0; | ||
/** | ||
* Returns the UNIX file permissions for the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getUnixMode = function() { | ||
return this.platform !== constants.PLATFORM_UNIX ? 0 : ((this.getExternalAttributes() >> constants.SHORT_SHIFT) & constants.SHORT_MASK) & constants.MODE_MASK; | ||
return this.platform !== constants.PLATFORM_UNIX ? 0 : ((this.getExternalAttributes() >> constants.SHORT_SHIFT) & constants.SHORT_MASK); | ||
}; | ||
/** | ||
* Returns the version of ZIP needed to extract the entry. | ||
* | ||
* @returns {number} | ||
*/ | ||
ZipArchiveEntry.prototype.getVersionNeededToExtract = function() { | ||
@@ -138,2 +229,7 @@ return this.minver; | ||
/** | ||
* Sets the comment of the entry. | ||
* | ||
* @param comment | ||
*/ | ||
ZipArchiveEntry.prototype.setComment = function(comment) { | ||
@@ -147,2 +243,7 @@ if (Buffer.byteLength(comment) !== comment.length) { | ||
/** | ||
* Sets the compressed size of the entry. | ||
* | ||
* @param size | ||
*/ | ||
ZipArchiveEntry.prototype.setCompressedSize = function(size) { | ||
@@ -156,2 +257,7 @@ if (size < 0) { | ||
/** | ||
* Sets the checksum of the entry. | ||
* | ||
* @param crc | ||
*/ | ||
ZipArchiveEntry.prototype.setCrc = function(crc) { | ||
@@ -165,2 +271,7 @@ if (crc < 0) { | ||
/** | ||
* Sets the external file attributes of the entry. | ||
* | ||
* @param attr | ||
*/ | ||
ZipArchiveEntry.prototype.setExternalAttributes = function(attr) { | ||
@@ -170,2 +281,7 @@ this.exattr = attr >>> 0; | ||
/** | ||
* Sets the extra fields related to the entry. | ||
* | ||
* @param extra | ||
*/ | ||
ZipArchiveEntry.prototype.setExtra = function(extra) { | ||
@@ -175,2 +291,7 @@ this.extra = extra; | ||
/** | ||
* Sets the general purpose bits related to the entry. | ||
* | ||
* @param gpb | ||
*/ | ||
ZipArchiveEntry.prototype.setGeneralPurposeBit = function(gpb) { | ||
@@ -184,2 +305,7 @@ if (!(gpb instanceof GeneralPurposeBit)) { | ||
/** | ||
* Sets the internal file attributes of the entry. | ||
* | ||
* @param attr | ||
*/ | ||
ZipArchiveEntry.prototype.setInternalAttributes = function(attr) { | ||
@@ -189,2 +315,7 @@ this.inattr = attr; | ||
/** | ||
* Sets the compression method of the entry. | ||
* | ||
* @param method | ||
*/ | ||
ZipArchiveEntry.prototype.setMethod = function(method) { | ||
@@ -198,2 +329,7 @@ if (method < 0) { | ||
/** | ||
* Sets the name of the entry. | ||
* | ||
* @param name | ||
*/ | ||
ZipArchiveEntry.prototype.setName = function(name) { | ||
@@ -209,2 +345,7 @@ name = normalizePath(name, false).replace(/^\w+:/, '').replace(/^(\.\.\/|\/)+/, ''); | ||
/** | ||
* Sets the platform on which the entry was made. | ||
* | ||
* @param platform | ||
*/ | ||
ZipArchiveEntry.prototype.setPlatform = function(platform) { | ||
@@ -214,2 +355,7 @@ this.platform = platform; | ||
/** | ||
* Sets the size of the entry. | ||
* | ||
* @param size | ||
*/ | ||
ZipArchiveEntry.prototype.setSize = function(size) { | ||
@@ -223,2 +369,8 @@ if (size < 0) { | ||
/** | ||
* Sets the time of the entry. | ||
* | ||
* @param time | ||
* @param forceLocalTime | ||
*/ | ||
ZipArchiveEntry.prototype.setTime = function(time, forceLocalTime) { | ||
@@ -232,4 +384,8 @@ if (!(time instanceof Date)) { | ||
/** | ||
* Sets the UNIX file permissions for the entry. | ||
* | ||
* @param mode | ||
*/ | ||
ZipArchiveEntry.prototype.setUnixMode = function(mode) { | ||
mode &= ~constants.S_IFMT; | ||
mode |= this.isDirectory() ? constants.S_IFDIR : constants.S_IFREG; | ||
@@ -245,2 +401,7 @@ | ||
/** | ||
* Sets the version of ZIP needed to extract this entry. | ||
* | ||
* @param minver | ||
*/ | ||
ZipArchiveEntry.prototype.setVersionNeededToExtract = function(minver) { | ||
@@ -250,2 +411,7 @@ this.minver = minver; | ||
/** | ||
* Returns true if this entry represents a directory. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
ZipArchiveEntry.prototype.isDirectory = function() { | ||
@@ -255,8 +421,20 @@ return this.getName().slice(-1) === '/'; | ||
/** | ||
* Returns true if this entry represents a unix symlink, | ||
* in which case the entry's content contains the target path | ||
* for the symlink. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
ZipArchiveEntry.prototype.isUnixSymlink = function() { | ||
return (this.getUnixMode() & constants.S_IFLINK) === constants.S_IFLINK; | ||
return (this.getUnixMode() & UnixStat.FILE_TYPE_FLAG) === UnixStat.LINK_FLAG; | ||
}; | ||
/** | ||
* Returns true if this entry is using the ZIP64 extension of ZIP. | ||
* | ||
* @returns {boolean} | ||
*/ | ||
ZipArchiveEntry.prototype.isZip64 = function() { | ||
return this.csize > constants.ZIP64_MAGIC || this.size > constants.ZIP64_MAGIC; | ||
}; | ||
}; |
@@ -171,3 +171,4 @@ /** | ||
function handleStuff() { | ||
ae.setCrc(process.digest()); | ||
var digest = process.digest().readUInt32BE(0); | ||
ae.setCrc(digest); | ||
ae.setSize(process.size()); | ||
@@ -174,0 +175,0 @@ ae.setCompressedSize(process.size(true)); |
{ | ||
"name": "compress-commons", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "a library that defines a common interface for working with archive formats within node", | ||
@@ -30,3 +30,3 @@ "homepage": "https://github.com/archiverjs/node-compress-commons", | ||
"buffer-crc32": "^0.2.1", | ||
"crc32-stream": "^1.0.0", | ||
"crc32-stream": "^2.0.0", | ||
"normalize-path": "^2.0.0", | ||
@@ -37,3 +37,3 @@ "readable-stream": "^2.0.0" | ||
"chai": "^3.4.0", | ||
"mocha": "^2.3.3", | ||
"mocha": "^3.2.0", | ||
"rimraf": "^2.4.3", | ||
@@ -40,0 +40,0 @@ "mkdirp": "^0.5.0" |
@@ -1,2 +0,2 @@ | ||
# Compress Commons v1.0.0 [![Build Status](https://travis-ci.org/archiverjs/node-compress-commons.svg?branch=master)](https://travis-ci.org/archiverjs/node-compress-commons) [![Build status](https://ci.appveyor.com/api/projects/status/fx3066dufdpar0it/branch/master?svg=true)](https://ci.appveyor.com/project/ctalkington/node-compress-commons/branch/master) | ||
# Compress Commons v1.2.0 [![Build Status](https://travis-ci.org/archiverjs/node-compress-commons.svg?branch=master)](https://travis-ci.org/archiverjs/node-compress-commons) [![Build status](https://ci.appveyor.com/api/projects/status/fx3066dufdpar0it/branch/master?svg=true)](https://ci.appveyor.com/project/ctalkington/node-compress-commons/branch/master) | ||
@@ -3,0 +3,0 @@ Compress Commons is a library that defines a common interface for working with archive formats within node. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37462
13
1065
+ Addedcrc32-stream@2.0.0(transitive)
- Removedcrc32-stream@1.0.1(transitive)
Updatedcrc32-stream@^2.0.0