Comparing version 1.1.31 to 1.1.32
@@ -21,3 +21,3 @@ (function () { | ||
assert(streams, 'streams could not be empty!'); | ||
assert(options, 'callback could not be empty!'); | ||
assert(callback, 'callback could not be empty!'); | ||
@@ -24,0 +24,0 @@ pipe(streams, options, callback); |
{ | ||
"name": "pipe-io", | ||
"version": "1.1.31", | ||
"version": "1.1.32", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -5,0 +5,0 @@ "description": "Pipe streams and handle events", |
@@ -1,2 +0,2 @@ | ||
Pipe-io | ||
Pipe-io [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] | ||
========= | ||
@@ -46,1 +46,11 @@ Pipe [streams](https://github.com/substack/stream-handbook) and handle events. | ||
MIT | ||
[NPMIMGURL]: https://img.shields.io/npm/v/pipe-io.svg?style=flat | ||
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/pipe-io/master.svg?style=flat | ||
[DependencyStatusIMGURL]: https://img.shields.io/gemnasium/coderaiser/pipe-io.svg?style=flat | ||
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat | ||
[NPMURL]: https://npmjs.org/package/pipe-io "npm" | ||
[BuildStatusURL]: https://travis-ci.org/coderaiser/pipe-io "Build Status" | ||
[DependencyStatusURL]: https://gemnasium.com/coderaiser/pipe-io "Dependency Status" | ||
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License" | ||
@@ -7,10 +7,19 @@ (function() { | ||
os = require('os'), | ||
zlib = require('zlib'), | ||
pipe = require('..'), | ||
test = require('tape'); | ||
test = require('tape'), | ||
random = Math.random(); | ||
test('check parameters', function(t) { | ||
t.throws(pipe, /streams could not be empty!/, 'check streams'); | ||
t.throws(pipe.bind(null, []), /callback could not be empty!/, 'check callback'); | ||
t.end(); | ||
}); | ||
test('file1 | file2: no error', function(t) { | ||
var tmp = os.tmpdir(), | ||
name = path.basename(__filename), | ||
nameTmp = path.join(tmp, name + Math.random()); | ||
nameTmp = path.join(tmp, name + random); | ||
@@ -30,3 +39,3 @@ tryPipe(__filename, nameTmp, function() { | ||
var name = path.basename(__filename), | ||
nameTmp = '/' + name + Math.random(); | ||
nameTmp = '/' + name + random; | ||
@@ -42,3 +51,2 @@ tryPipe(__filename, nameTmp, function(error) { | ||
var tmp = os.tmpdir(), | ||
random = Math.random(), | ||
name = path.basename(__filename), | ||
@@ -54,2 +62,54 @@ nameTmp = path.join(tmp, name + random); | ||
test('file1 | gzip | file2: no errors', function(t) { | ||
var tmp = os.tmpdir(), | ||
name = path.basename(__filename), | ||
nameTmp = path.join(tmp, name + random), | ||
read = fs.createReadStream(__filename), | ||
write = fs.createWriteStream(nameTmp), | ||
zip = zlib.createGzip(); | ||
pipe([read, zip, write], function(error) { | ||
var file1 = fs.readFileSync(__filename, 'utf8'), | ||
file2 = fs.readFileSync(nameTmp), | ||
zip = zlib.gzipSync(file1); | ||
fs.unlinkSync(nameTmp); | ||
t.notOk(error, 'no errors'); | ||
t.deepEqual(zip, file2, 'file gziped'); | ||
t.end(); | ||
}); | ||
}); | ||
test('file1 | gzip', function(t) { | ||
var read = fs.createReadStream(__filename), | ||
zip = zlib.createGzip(); | ||
pipe([read, zip], function(error) { | ||
t.notOk(error, 'no errors'); | ||
t.end(); | ||
}); | ||
}); | ||
test('file1 | gzip: error ENOENT', function(t) { | ||
var read = fs.createReadStream(__filename + random), | ||
zip = zlib.createGzip(); | ||
pipe([read, zip], function(error) { | ||
t.ok(error, error.message); | ||
t.end(); | ||
}); | ||
}); | ||
test('file1 | gzip: error EISDIR', function(t) { | ||
var read = fs.createReadStream('/'), | ||
zip = zlib.createGzip(); | ||
pipe([read, zip], function(error) { | ||
t.ok(error, error.message); | ||
t.end(); | ||
}); | ||
}); | ||
function tryPipe(from, to, fn) { | ||
@@ -56,0 +116,0 @@ var read = fs.createReadStream(from), |
Sorry, the diff of this file is not supported yet
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
15476
256
56