'use strict';

var archiveType = require('../');
var path = require('path');
var read = require('fs').readFile;
var test = require('ava');

test('detect archive type from Buffer', function (t) {
	t.plan(4);

	read(path.join(__dirname, 'fixtures/test.tar'), function (err, buf) {
		t.assert(!err);
		t.assert(archiveType(buf) === 'tar');

		read(path.join(__dirname, 'fixtures/test.zip'), function (err, buf) {
			t.assert(!err);
			t.assert(archiveType(buf) === 'zip');
		});
	});
});

@@ -38,24 +38,48 @@
 ire('../');%0A
+var fs = require('fs');%0A
 var path = r
@@ -98,20 +98,21 @@
 ');%0Avar 
-read
+spawn
  = requi
@@ -119,21 +119,29 @@
 re('
-fs').readFile
+child_process').spawn
 ;%0Ava
@@ -235,20 +235,27 @@
 n(4);%0A%0A%09
+fs.
 read
+File
 (path.jo
@@ -373,20 +373,27 @@
 r');%0A%0A%09%09
+fs.
 read
+File
 (path.jo
@@ -521,12 +521,375 @@
 );%0A%09%7D);%0A%7D);%0A
+%0Atest('detect archive type from Buffer using CLI', function (t) %7B%0A%09t.plan(2);%0A%0A%09var src = fs.createReadStream(path.join(__dirname, 'fixtures/test.tar'));%0A%09var cp = spawn(path.join(__dirname, '../cli.js'));%0A%0A%09cp.stdout.setEncoding('utf8');%0A%09cp.stdout.on('data', function (data) %7B%0A%09%09t.assert(data);%0A%09%09t.assert(data.trim() === 'tar');%0A%09%7D);%0A%0A%09src.pipe(cp.stdin);%0A%7D);%0A

Add CLI test