git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
6e9c872
Branches
Tags
develop-client_server
master
typescript
fs-words.git
server
lib
node_modules
tar
test
parse-discard.js
[add] server:lib:node_modules
Christian Fraß
commited
6e9c872
at 2021-03-08 23:52:07
parse-discard.js
Blame
History
Raw
var tap = require("tap") , tar = require("../tar.js") , fs = require("fs") , path = require("path") , file = path.resolve(__dirname, "fixtures/c.tar") tap.test("parser test", function (t) { var parser = tar.Parse() var total = 0 var dataTotal = 0 parser.on("end", function () { t.equals(total-513,dataTotal,'should have discarded only c.txt') t.end() }) fs.createReadStream(file) .pipe(parser) .on('entry',function(entry){ if(entry.path === 'c.txt') entry.abort() total += entry.size; entry.on('data',function(data){ dataTotal += data.length }) }) })