+18
-9
@@ -76,6 +76,6 @@ /* | ||
| var entry = new ArEntry(header, self); | ||
| var size = entry.dataSize(); | ||
| readChunks(new Buffer(size), 0, offset+60, size, function(data) { | ||
| if(data) { | ||
| entry.data = data; | ||
| var bsdNameSize = entry.nameSizeBSD(); | ||
| readChunks(new Buffer(bsdNameSize), 0, offset+60, bsdNameSize, function(bsdNameData) { | ||
| if(bsdNameData) { | ||
| entry.bsdName = trimNulls(bsdNameData.toString('utf8', 0, bsdNameSize)); | ||
| var nextOffset = entry.totalSize()+offset; | ||
@@ -92,4 +92,14 @@ var nexted = false; | ||
| self.gnuEntry = entry; | ||
| next(); | ||
| var size = entry.fileSize(); | ||
| readChunks(new Buffer(size), 0, offset+60+bsdNameSize, size, function(gnuData) { | ||
| self.gnuEntry.data = gnuData; | ||
| next(); | ||
| }); | ||
| } else { | ||
| entry.stream = fs.createReadStream(self.file, { | ||
| fd: fd, | ||
| autoClose: false, | ||
| start: offset+60+bsdNameSize, | ||
| end: offset+60+entry.dataSize()-1 | ||
| }); | ||
| self.emit("entry", entry, next); | ||
@@ -118,3 +128,3 @@ } | ||
| var start = parseInt(shortName.replace("/", ""), 10); | ||
| var resolved = this.gnuEntry.fileData().toString('ascii', start); | ||
| var resolved = this.gnuEntry.data.toString('utf8', start); | ||
| return resolved.substring(0, resolved.indexOf("\n")); | ||
@@ -215,3 +225,3 @@ } catch(e) { | ||
| // NULL bytes and include that in the length, so we must strip them out. | ||
| name = trimNulls(this.data.toString('utf8', 0, length)); | ||
| name = this.bsdName; | ||
| } else if(this.archive && this.archive.isGNU() && name.indexOf("/")===0) { | ||
@@ -299,4 +309,3 @@ name = this.archive.resolveNameGNU(name); | ||
| ArEntry.prototype.fileData = function () { | ||
| var headerSize = this.headerSize(), bsdOffset = this.nameSizeBSD(); | ||
| return this.data.slice(bsdOffset, headerSize + this.dataSize()); | ||
| return this.stream; | ||
| }; | ||
@@ -303,0 +312,0 @@ |
+1
-1
| { | ||
| "name": "ar-async", | ||
| "description": "Asynchronously read and write Unix archive files.", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "homepage": "https://github.com/JayCanuck/node-ar-async", | ||
@@ -6,0 +6,0 @@ "author": { |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
18683
1.89%433
2.12%