diff --git a/test/extract.js b/test/extract.js index e758b27..4bec7a4 100644 --- a/test/extract.js +++ b/test/extract.js @@ -1,437 +1,437 @@ -var test = require('tape'); -var tar = require('../index'); -var fixtures = require('./fixtures'); -var concat = require('concat-stream'); -var fs = require('fs'); +var test = require('tape') +var tar = require('../index') +var fixtures = require('./fixtures') +var concat = require('concat-stream') +var fs = require('fs') var clamp = function(index, len, defaultValue) { - if (typeof index !== 'number') return defaultValue; - index = ~~index; // Coerce to integer. - if (index >= len) return len; - if (index >= 0) return index; - index += len; - if (index >= 0) return index; - return 0; -}; + if (typeof index !== 'number') return defaultValue + index = ~~index // Coerce to integer. + if (index >= len) return len + if (index >= 0) return index + index += len + if (index >= 0) return index + return 0 +} test('one-file', function(t) { - t.plan(3); + t.plan(3) - var extract = tar.extract(); - var noEntries = false; + var extract = tar.extract() + var noEntries = false - extract.on('entry', function(header, stream, callback) { - t.deepEqual(header, { - name: 'test.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 12, - mtime: new Date(1387580181000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + extract.on('entry', function(header, stream, callback) { + t.deepEqual(header, { + name: 'test.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 12, + mtime: new Date(1387580181000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - stream.pipe(concat(function(data) { - noEntries = true; - t.same(data.toString(), 'hello world\n'); - callback(); - })); - }); + stream.pipe(concat(function(data) { + noEntries = true + t.same(data.toString(), 'hello world\n') + callback() + })) + }) - extract.on('finish', function() { - t.ok(noEntries); - }); + extract.on('finish', function() { + t.ok(noEntries) + }) - extract.end(fs.readFileSync(fixtures.ONE_FILE_TAR)); -}); + extract.end(fs.readFileSync(fixtures.ONE_FILE_TAR)) +}) test('chunked-one-file', function(t) { - t.plan(3); + t.plan(3) - var extract = tar.extract(); - var noEntries = false; + var extract = tar.extract() + var noEntries = false - extract.on('entry', function(header, stream, callback) { - t.deepEqual(header, { - name: 'test.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 12, - mtime: new Date(1387580181000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + extract.on('entry', function(header, stream, callback) { + t.deepEqual(header, { + name: 'test.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 12, + mtime: new Date(1387580181000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - stream.pipe(concat(function(data) { - noEntries = true; - t.same(data.toString(), 'hello world\n'); - callback(); - })); - }); + stream.pipe(concat(function(data) { + noEntries = true + t.same(data.toString(), 'hello world\n') + callback() + })) + }) - extract.on('finish', function() { - t.ok(noEntries); - }); + extract.on('finish', function() { + t.ok(noEntries) + }) - var b = fs.readFileSync(fixtures.ONE_FILE_TAR); + var b = fs.readFileSync(fixtures.ONE_FILE_TAR) - for (var i = 0; i < b.length; i += 321) { - extract.write(b.slice(i, clamp(i+321, b.length, b.length))); - } - extract.end(); -}); + for (var i = 0; i < b.length; i += 321) { + extract.write(b.slice(i, clamp(i+321, b.length, b.length))) + } + extract.end() +}) test('multi-file', function(t) { - t.plan(5); + t.plan(5) - var extract = tar.extract(); - var noEntries = false; + var extract = tar.extract() + var noEntries = false - var onfile1 = function(header, stream, callback) { - t.deepEqual(header, { - name: 'file-1.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 12, - mtime: new Date(1387580181000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + var onfile1 = function(header, stream, callback) { + t.deepEqual(header, { + name: 'file-1.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 12, + mtime: new Date(1387580181000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - extract.on('entry', onfile2); - stream.pipe(concat(function(data) { - t.same(data.toString(), 'i am file-1\n'); - callback(); - })); - }; + extract.on('entry', onfile2) + stream.pipe(concat(function(data) { + t.same(data.toString(), 'i am file-1\n') + callback() + })) + } - var onfile2 = function(header, stream, callback) { - t.deepEqual(header, { - name: 'file-2.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 12, - mtime: new Date(1387580181000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + var onfile2 = function(header, stream, callback) { + t.deepEqual(header, { + name: 'file-2.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 12, + mtime: new Date(1387580181000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - stream.pipe(concat(function(data) { - noEntries = true; - t.same(data.toString(), 'i am file-2\n'); - callback(); - })); - }; + stream.pipe(concat(function(data) { + noEntries = true + t.same(data.toString(), 'i am file-2\n') + callback() + })) + } - extract.once('entry', onfile1); + extract.once('entry', onfile1) - extract.on('finish', function() { - t.ok(noEntries); - }); + extract.on('finish', function() { + t.ok(noEntries) + }) - extract.end(fs.readFileSync(fixtures.MULTI_FILE_TAR)); -}); + extract.end(fs.readFileSync(fixtures.MULTI_FILE_TAR)) +}) test('chunked-multi-file', function(t) { - t.plan(5); + t.plan(5) - var extract = tar.extract(); - var noEntries = false; + var extract = tar.extract() + var noEntries = false - var onfile1 = function(header, stream, callback) { - t.deepEqual(header, { - name: 'file-1.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 12, - mtime: new Date(1387580181000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + var onfile1 = function(header, stream, callback) { + t.deepEqual(header, { + name: 'file-1.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 12, + mtime: new Date(1387580181000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - extract.on('entry', onfile2); - stream.pipe(concat(function(data) { - t.same(data.toString(), 'i am file-1\n'); - callback(); - })); - }; + extract.on('entry', onfile2) + stream.pipe(concat(function(data) { + t.same(data.toString(), 'i am file-1\n') + callback() + })) + } - var onfile2 = function(header, stream, callback) { - t.deepEqual(header, { - name: 'file-2.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 12, - mtime: new Date(1387580181000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + var onfile2 = function(header, stream, callback) { + t.deepEqual(header, { + name: 'file-2.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 12, + mtime: new Date(1387580181000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - stream.pipe(concat(function(data) { - noEntries = true; - t.same(data.toString(), 'i am file-2\n'); - callback(); - })); - }; + stream.pipe(concat(function(data) { + noEntries = true + t.same(data.toString(), 'i am file-2\n') + callback() + })) + } - extract.once('entry', onfile1); + extract.once('entry', onfile1) - extract.on('finish', function() { - t.ok(noEntries); - }); + extract.on('finish', function() { + t.ok(noEntries) + }) - var b = fs.readFileSync(fixtures.MULTI_FILE_TAR); - for (var i = 0; i < b.length; i += 321) { - extract.write(b.slice(i, clamp(i+321, b.length, b.length))); - } - extract.end(); -}); + var b = fs.readFileSync(fixtures.MULTI_FILE_TAR) + for (var i = 0; i < b.length; i += 321) { + extract.write(b.slice(i, clamp(i+321, b.length, b.length))) + } + extract.end() +}) test('types', function(t) { - t.plan(3); + t.plan(3) - var extract = tar.extract(); - var noEntries = false; + var extract = tar.extract() + var noEntries = false - var ondir = function(header, stream, callback) { - t.deepEqual(header, { - name: 'directory', - mode: 0755, - uid: 501, - gid: 20, - size: 0, - mtime: new Date(1387580181000), - type: 'directory', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); - stream.on('data', function() { - t.ok(false); - }); - extract.once('entry', onlink); - callback(); - }; + var ondir = function(header, stream, callback) { + t.deepEqual(header, { + name: 'directory', + mode: 0755, + uid: 501, + gid: 20, + size: 0, + mtime: new Date(1387580181000), + type: 'directory', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) + stream.on('data', function() { + t.ok(false) + }) + extract.once('entry', onlink) + callback() + } - var onlink = function(header, stream, callback) { - t.deepEqual(header, { - name: 'directory-link', - mode: 0755, - uid: 501, - gid: 20, - size: 0, - mtime: new Date(1387580181000), - type: 'symlink', - linkname: 'directory', - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); - stream.on('data', function() { - t.ok(false); - }); - noEntries = true; - callback(); - }; + var onlink = function(header, stream, callback) { + t.deepEqual(header, { + name: 'directory-link', + mode: 0755, + uid: 501, + gid: 20, + size: 0, + mtime: new Date(1387580181000), + type: 'symlink', + linkname: 'directory', + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) + stream.on('data', function() { + t.ok(false) + }) + noEntries = true + callback() + } - extract.once('entry', ondir); + extract.once('entry', ondir) - extract.on('finish', function() { - t.ok(noEntries); - }); + extract.on('finish', function() { + t.ok(noEntries) + }) - extract.end(fs.readFileSync(fixtures.TYPES_TAR)); -}); + extract.end(fs.readFileSync(fixtures.TYPES_TAR)) +}) test('long-name', function(t) { - t.plan(3); + t.plan(3) - var extract = tar.extract(); - var noEntries = false; + var extract = tar.extract() + var noEntries = false - extract.on('entry', function(header, stream, callback) { - t.deepEqual(header, { - name: 'my/file/is/longer/than/100/characters/and/should/use/the/prefix/header/foobarbaz/foobarbaz/foobarbaz/foobarbaz/foobarbaz/foobarbaz/filename.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 16, - mtime: new Date(1387580181000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + extract.on('entry', function(header, stream, callback) { + t.deepEqual(header, { + name: 'my/file/is/longer/than/100/characters/and/should/use/the/prefix/header/foobarbaz/foobarbaz/foobarbaz/foobarbaz/foobarbaz/foobarbaz/filename.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 16, + mtime: new Date(1387580181000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - stream.pipe(concat(function(data) { - noEntries = true; - t.same(data.toString(), 'hello long name\n'); - callback(); - })); - }); + stream.pipe(concat(function(data) { + noEntries = true + t.same(data.toString(), 'hello long name\n') + callback() + })) + }) - extract.on('finish', function() { - t.ok(noEntries); - }); + extract.on('finish', function() { + t.ok(noEntries) + }) - extract.end(fs.readFileSync(fixtures.LONG_NAME_TAR)); -}); + extract.end(fs.readFileSync(fixtures.LONG_NAME_TAR)) +}) test('unicode-bsd', function(t) { // can unpack a bsdtar unicoded tarball - t.plan(3); + t.plan(3) - var extract = tar.extract(); - var noEntries = false; + var extract = tar.extract() + var noEntries = false - extract.on('entry', function(header, stream, callback) { - t.deepEqual(header, { - name: 'høllø.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 4, - mtime: new Date(1387588646000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + extract.on('entry', function(header, stream, callback) { + t.deepEqual(header, { + name: 'høllø.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 4, + mtime: new Date(1387588646000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - stream.pipe(concat(function(data) { - noEntries = true; - t.same(data.toString(), 'hej\n'); - callback(); - })); - }); + stream.pipe(concat(function(data) { + noEntries = true + t.same(data.toString(), 'hej\n') + callback() + })) + }) - extract.on('finish', function() { - t.ok(noEntries); - }); + extract.on('finish', function() { + t.ok(noEntries) + }) - extract.end(fs.readFileSync(fixtures.UNICODE_BSD_TAR)); -}); + extract.end(fs.readFileSync(fixtures.UNICODE_BSD_TAR)) +}) test('unicode', function(t) { // can unpack a bsdtar unicoded tarball - t.plan(3); + t.plan(3) - var extract = tar.extract(); - var noEntries = false; + var extract = tar.extract() + var noEntries = false - extract.on('entry', function(header, stream, callback) { - t.deepEqual(header, { - name: 'høstål.txt', - mode: 0644, - uid: 501, - gid: 20, - size: 8, - mtime: new Date(1387580181000), - type: 'file', - linkname: null, - uname: 'maf', - gname: 'staff', - devmajor: 0, - devminor: 0 - }); + extract.on('entry', function(header, stream, callback) { + t.deepEqual(header, { + name: 'høstål.txt', + mode: 0644, + uid: 501, + gid: 20, + size: 8, + mtime: new Date(1387580181000), + type: 'file', + linkname: null, + uname: 'maf', + gname: 'staff', + devmajor: 0, + devminor: 0 + }) - stream.pipe(concat(function(data) { - noEntries = true; - t.same(data.toString(), 'høllø\n'); - callback(); - })); - }); + stream.pipe(concat(function(data) { + noEntries = true + t.same(data.toString(), 'høllø\n') + callback() + })) + }) - extract.on('finish', function() { - t.ok(noEntries); - }); + extract.on('finish', function() { + t.ok(noEntries) + }) - extract.end(fs.readFileSync(fixtures.UNICODE_TAR)); -}); + extract.end(fs.readFileSync(fixtures.UNICODE_TAR)) +}) test('name-is-100', function(t) { - t.plan(3); + t.plan(3) - var extract = tar.extract(); + var extract = tar.extract() - extract.on('entry', function(header, stream, callback) { - t.same(header.name.length, 100); + extract.on('entry', function(header, stream, callback) { + t.same(header.name.length, 100) - stream.pipe(concat(function(data) { - t.same(data.toString(), 'hello\n'); - callback(); - })); - }); + stream.pipe(concat(function(data) { + t.same(data.toString(), 'hello\n') + callback() + })) + }) - extract.on('finish', function() { - t.ok(true); - }); + extract.on('finish', function() { + t.ok(true) + }) - extract.end(fs.readFileSync(fixtures.NAME_IS_100_TAR)); -}); + extract.end(fs.readFileSync(fixtures.NAME_IS_100_TAR)) +}) test('invalid-file', function(t) { - t.plan(1); + t.plan(1) - var extract = tar.extract(); + var extract = tar.extract() - extract.on('error', function(err) { - t.ok(!!err); - extract.destroy(); - }); + extract.on('error', function(err) { + t.ok(!!err) + extract.destroy() + }) - extract.end(fs.readFileSync(fixtures.INVALID_TGZ)); -}); + extract.end(fs.readFileSync(fixtures.INVALID_TGZ)) +}) test('space prefixed', function(t) { - t.plan(5); + t.plan(5) - var extract = tar.extract(); + var extract = tar.extract() - extract.on('entry', function(header, stream, callback) { - t.ok(true) - callback(); - }); + extract.on('entry', function(header, stream, callback) { + t.ok(true) + callback() + }) - extract.on('finish', function() { - t.ok(true); - }); + extract.on('finish', function() { + t.ok(true) + }) - extract.end(fs.readFileSync(fixtures.SPACE_TAR_GZ)); -}); + extract.end(fs.readFileSync(fixtures.SPACE_TAR_GZ)) +}) diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 0c4b283..d058613 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -1,11 +1,11 @@ -var path = require('path'); +var path = require('path') -exports.ONE_FILE_TAR = path.join(__dirname, 'one-file.tar'); -exports.MULTI_FILE_TAR = path.join(__dirname, 'multi-file.tar'); -exports.TYPES_TAR = path.join(__dirname, 'types.tar'); -exports.LONG_NAME_TAR = path.join(__dirname, 'long-name.tar'); -exports.UNICODE_BSD_TAR = path.join(__dirname, 'unicode-bsd.tar'); -exports.UNICODE_TAR = path.join(__dirname, 'unicode.tar'); -exports.NAME_IS_100_TAR = path.join(__dirname, 'name-is-100.tar'); -exports.INVALID_TGZ = path.join(__dirname, 'invalid.tgz'); -exports.SPACE_TAR_GZ = path.join(__dirname, 'space.tar'); +exports.ONE_FILE_TAR = path.join(__dirname, 'one-file.tar') +exports.MULTI_FILE_TAR = path.join(__dirname, 'multi-file.tar') +exports.TYPES_TAR = path.join(__dirname, 'types.tar') +exports.LONG_NAME_TAR = path.join(__dirname, 'long-name.tar') +exports.UNICODE_BSD_TAR = path.join(__dirname, 'unicode-bsd.tar') +exports.UNICODE_TAR = path.join(__dirname, 'unicode.tar') +exports.NAME_IS_100_TAR = path.join(__dirname, 'name-is-100.tar') +exports.INVALID_TGZ = path.join(__dirname, 'invalid.tgz') +exports.SPACE_TAR_GZ = path.join(__dirname, 'space.tar') diff --git a/test/pack.js b/test/pack.js index 415a9bd..89dadf2 100644 --- a/test/pack.js +++ b/test/pack.js @@ -1,144 +1,144 @@ -var test = require('tape'); -var tar = require('../index'); -var fixtures = require('./fixtures'); -var concat = require('concat-stream'); -var fs = require('fs'); +var test = require('tape') +var tar = require('../index') +var fixtures = require('./fixtures') +var concat = require('concat-stream') +var fs = require('fs') test('one-file', function(t) { - t.plan(2); + t.plan(2) - var pack = tar.pack(); + var pack = tar.pack() - pack.entry({ - name:'test.txt', - mtime:new Date(1387580181000), - mode:0644, - uname:'maf', - gname:'staff', - uid:501, - gid:20 - }, 'hello world\n'); + pack.entry({ + name:'test.txt', + mtime:new Date(1387580181000), + mode:0644, + uname:'maf', + gname:'staff', + uid:501, + gid:20 + }, 'hello world\n') - pack.finalize(); + pack.finalize() - pack.pipe(concat(function(data) { - t.same(data.length & 511, 0); - t.deepEqual(data, fs.readFileSync(fixtures.ONE_FILE_TAR)); - })); -}); + pack.pipe(concat(function(data) { + t.same(data.length & 511, 0) + t.deepEqual(data, fs.readFileSync(fixtures.ONE_FILE_TAR)) + })) +}) test('multi-file', function(t) { - t.plan(2); + t.plan(2) - var pack = tar.pack(); + var pack = tar.pack() - pack.entry({ - name:'file-1.txt', - mtime:new Date(1387580181000), - mode:0644, - uname:'maf', - gname:'staff', - uid:501, - gid:20 - }, 'i am file-1\n'); + pack.entry({ + name:'file-1.txt', + mtime:new Date(1387580181000), + mode:0644, + uname:'maf', + gname:'staff', + uid:501, + gid:20 + }, 'i am file-1\n') - pack.entry({ - name:'file-2.txt', - mtime:new Date(1387580181000), - mode:0644, - size:12, - uname:'maf', - gname:'staff', - uid:501, - gid:20 - }).end('i am file-2\n'); + pack.entry({ + name:'file-2.txt', + mtime:new Date(1387580181000), + mode:0644, + size:12, + uname:'maf', + gname:'staff', + uid:501, + gid:20 + }).end('i am file-2\n') - pack.finalize(); + pack.finalize() - pack.pipe(concat(function(data) { - t.same(data.length & 511, 0); - t.deepEqual(data, fs.readFileSync(fixtures.MULTI_FILE_TAR)); - })); -}); + pack.pipe(concat(function(data) { + t.same(data.length & 511, 0) + t.deepEqual(data, fs.readFileSync(fixtures.MULTI_FILE_TAR)) + })) +}) test('types', function(t) { - t.plan(2); - var pack = tar.pack(); + t.plan(2) + var pack = tar.pack() - pack.entry({ - name:'directory', - mtime:new Date(1387580181000), - type:'directory', - mode:0755, - uname:'maf', - gname:'staff', - uid:501, - gid:20 - }); + pack.entry({ + name:'directory', + mtime:new Date(1387580181000), + type:'directory', + mode:0755, + uname:'maf', + gname:'staff', + uid:501, + gid:20 + }) - pack.entry({ - name:'directory-link', - mtime:new Date(1387580181000), - type:'symlink', - linkname: 'directory', - mode:0755, - uname:'maf', - gname:'staff', - uid:501, - gid:20 - }); + pack.entry({ + name:'directory-link', + mtime:new Date(1387580181000), + type:'symlink', + linkname: 'directory', + mode:0755, + uname:'maf', + gname:'staff', + uid:501, + gid:20 + }) - pack.finalize(); + pack.finalize() - pack.pipe(concat(function(data) { - t.equal(data.length & 511, 0); - t.deepEqual(data, fs.readFileSync(fixtures.TYPES_TAR)); - })); + pack.pipe(concat(function(data) { + t.equal(data.length & 511, 0) + t.deepEqual(data, fs.readFileSync(fixtures.TYPES_TAR)) + })) -}); +}) test('long-name', function(t) { - t.plan(2); - var pack = tar.pack(); + t.plan(2) + var pack = tar.pack() - pack.entry({ - name:'my/file/is/longer/than/100/characters/and/should/use/the/prefix/header/foobarbaz/foobarbaz/foobarbaz/foobarbaz/foobarbaz/foobarbaz/filename.txt', - mtime:new Date(1387580181000), - type:'file', - mode:0644, - uname:'maf', - gname:'staff', - uid:501, - gid:20 - }, 'hello long name\n'); + pack.entry({ + name:'my/file/is/longer/than/100/characters/and/should/use/the/prefix/header/foobarbaz/foobarbaz/foobarbaz/foobarbaz/foobarbaz/foobarbaz/filename.txt', + mtime:new Date(1387580181000), + type:'file', + mode:0644, + uname:'maf', + gname:'staff', + uid:501, + gid:20 + }, 'hello long name\n') - pack.finalize(); + pack.finalize() - pack.pipe(concat(function(data) { - t.equal(data.length & 511, 0); - t.deepEqual(data, fs.readFileSync(fixtures.LONG_NAME_TAR)); - })); -}); + pack.pipe(concat(function(data) { + t.equal(data.length & 511, 0) + t.deepEqual(data, fs.readFileSync(fixtures.LONG_NAME_TAR)) + })) +}) test('unicode', function(t) { - t.plan(2); - var pack = tar.pack(); + t.plan(2) + var pack = tar.pack() - pack.entry({ - name:'høstål.txt', - mtime:new Date(1387580181000), - type:'file', - mode:0644, - uname:'maf', - gname:'staff', - uid:501, - gid:20 - }, 'høllø\n'); + pack.entry({ + name:'høstål.txt', + mtime:new Date(1387580181000), + type:'file', + mode:0644, + uname:'maf', + gname:'staff', + uid:501, + gid:20 + }, 'høllø\n') - pack.finalize(); + pack.finalize() - pack.pipe(concat(function(data) { - t.equal(data.length & 511, 0); - t.deepEqual(data, fs.readFileSync(fixtures.UNICODE_TAR)); - })); -}); \ No newline at end of file + pack.pipe(concat(function(data) { + t.equal(data.length & 511, 0) + t.deepEqual(data, fs.readFileSync(fixtures.UNICODE_TAR)) + })) +}) \ No newline at end of file