Initial Commit

This commit is contained in:
2018-05-19 02:20:19 +02:00
commit 8621248968
6554 changed files with 1121559 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
var spec = require('stream-spec')
var tester = require('stream-tester')
var ps = require('..')()
spec(ps)
.through({strict: false})
.validateOnExit()
var master = tester.createConsistent
tester.createRandomStream(1000) //1k random numbers
.pipe(master = tester.createConsistentStream())
.pipe(tester.createUnpauseStream())
.pipe(ps)
.pipe(tester.createPauseStream())
.pipe(master.createSlave())

View File

@@ -0,0 +1,33 @@
var pause = require('..')
var assert = require('assert')
var ps = pause()
var read = [], ended = false
ps.on('data', function (i) {
read.push(i)
})
ps.on('end', function () {
ended = true
})
assert.deepEqual(read, [])
ps.write(0)
ps.write(1)
ps.write(2)
assert.deepEqual(read, [0, 1, 2])
ps.pause()
assert.deepEqual(read, [0, 1, 2])
ps.end()
assert.equal(ended, false)
ps.resume()
assert.equal(ended, true)