Permalink
Browse files

wow. Be gone node_modules

  • Loading branch information...
1 parent 4e038c1 commit fef3e02453a648c23f64a1b8acdfc1c7ec1a564c @Raynos committed Aug 24, 2012
File renamed without changes.
View
@@ -1,3 +0,0 @@
-node_modules
-*.log
-*.err
@@ -1,3 +0,0 @@
-language: node_js
-node_js:
- - 0.8
@@ -1,19 +0,0 @@
-Copyright (c) 2012 Raynos.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
@@ -1,4 +0,0 @@
-test:
- node test.js
-
-.PHONY: test
@@ -1,36 +0,0 @@
-# duplexer [![build status][1]][2]
-
-Creates a duplex stream
-
-Taken from [event-stream][3]
-
-## duplex (writeStream, readStream)
-
-Takes a writable stream and a readable stream and makes them appear as a readable writable stream.
-
-It is assumed that the two streams are connected to each other in some way.
-
-## Example
-
- var grep = cp.exec('grep Stream')
-
- duplex(grep.stdin, grep.stdout)
-
-## Installation
-
-`npm install duplexer`
-
-## Tests
-
-`make test`
-
-## Contributors
-
- - Dominictarr
- - Raynos
-
-## MIT Licenced
-
- [1]: https://secure.travis-ci.org/Raynos/duplexer.png
- [2]: http://travis-ci.org/Raynos/duplexer
- [3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream
@@ -1,87 +0,0 @@
-var Stream = require("stream")
- , writeMethods = ["write", "end", "destroy"]
- , readMethods = ["resume", "pause"]
- , readEvents = ["data", "close"]
- , slice = Array.prototype.slice
-
-module.exports = duplex
-
-function duplex(writer, reader) {
- var stream = new Stream()
- , ended = false
-
- Object.defineProperties(stream, {
- writable: {
- get: getWritable
- }
- , readable: {
- get: getReadable
- }
- })
-
- writeMethods.forEach(proxyWriter)
-
- readMethods.forEach(proxyReader)
-
- readEvents.forEach(proxyStream)
-
- reader.on("end", handleEnd)
-
- writer.on("error", reemit)
- reader.on("error", reemit)
-
- return stream
-
- function getWritable() {
- return writer.writable
- }
-
- function getReadable() {
- return reader.readable
- }
-
- function proxyWriter(methodName) {
- stream[methodName] = method
-
- function method() {
- return writer[methodName].apply(writer, arguments)
- }
- }
-
- function proxyReader(methodName) {
- stream[methodName] = method
-
- function method() {
- stream.emit(methodName)
- var func = reader[methodName]
- if (func) {
- return func.apply(reader, arguments)
- }
- reader.emit(methodName)
- }
- }
-
- function proxyStream(methodName) {
- reader.on(methodName, reemit)
-
- function reemit() {
- var args = slice.call(arguments)
- args.unshift(methodName)
- stream.emit.apply(stream, args)
- }
- }
-
- function handleEnd() {
- if (ended) {
- return
- }
- ended = true
- var args = slice.call(arguments)
- args.unshift("end")
- stream.emit.apply(stream, args)
- }
-
- function reemit(err) {
- stream.emit("error", err)
- }
-}
@@ -1,41 +0,0 @@
-{
- "name": "duplexer",
- "version": "0.0.2",
- "description": "Creates a duplex stream",
- "keywords": [],
- "author": {
- "name": "Raynos",
- "email": "raynos2@gmail.com"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/Raynos/duplexer.git"
- },
- "main": "index",
- "homepage": "https://github.com/Raynos/duplexer",
- "contributors": [
- {
- "name": "Jake Verbaten"
- }
- ],
- "bugs": {
- "url": "https://github.com/Raynos/duplexer/issues",
- "email": "raynos2@gmail.com"
- },
- "dependencies": {},
- "devDependencies": {
- "through": "~0.1.4"
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "http://github.com/Raynos/duplexer/raw/master/LICENSE"
- }
- ],
- "scripts": {
- "test": "make test"
- },
- "readme": "# duplexer [![build status][1]][2]\n\nCreates a duplex stream\n\nTaken from [event-stream][3]\n\n## duplex (writeStream, readStream)\n\nTakes a writable stream and a readable stream and makes them appear as a readable writable stream.\n\nIt is assumed that the two streams are connected to each other in some way.\n\n## Example\n\n var grep = cp.exec('grep Stream')\n\n duplex(grep.stdin, grep.stdout)\n\n## Installation\n\n`npm install duplexer`\n\n## Tests\n\n`make test`\n\n## Contributors\n\n - Dominictarr\n - Raynos\n\n## MIT Licenced\n\n [1]: https://secure.travis-ci.org/Raynos/duplexer.png\n [2]: http://travis-ci.org/Raynos/duplexer\n [3]: https://github.com/dominictarr/event-stream#duplex-writestream-readstream",
- "_id": "duplexer@0.0.2",
- "_from": "duplexer"
-}
@@ -1,27 +0,0 @@
-var duplex = require("./index")
- , assert = require("assert")
- , through = require("through")
-
-var readable = through()
- , writable = through(write)
- , written = 0
- , data = 0
-
-var stream = duplex(writable, readable)
-
-function write() {
- written++
-}
-
-stream.on("data", ondata)
-
-function ondata() {
- data++
-}
-
-stream.write()
-readable.emit("data")
-
-assert.equal(written, 1)
-assert.equal(data, 1)
-console.log("DONE")
@@ -1,3 +0,0 @@
-node_modules
-node_modules/*
-npm_debug.log
@@ -1,76 +0,0 @@
-var Stream = require('stream')
-
-/*
- was gonna use through for this,
- but it does not match quite right,
- because you need a seperate pause
- mechanism for the readable and writable
- sides.
-*/
-
-module.exports = function () {
- var buffer = [], ended = false, destroyed = false
- var stream = new Stream()
- stream.writable = stream.readable = true
- stream.paused = false
-
- stream.write = function (data) {
- if(!this.paused)
- this.emit('data', data)
- else
- buffer.push(data)
- return !(this.paused || buffer.length)
- }
- function onEnd () {
- stream.readable = false
- stream.emit('end')
- process.nextTick(stream.destroy.bind(stream))
- }
- stream.end = function (data) {
- if(data) this.write(data)
- this.ended = true
- this.writable = false
- if(!(this.paused || buffer.length))
- return onEnd()
- else
- this.once('drain', onEnd)
- this.drain()
- }
-
- stream.drain = function () {
- while(!this.paused && buffer.length)
- this.emit('data', buffer.shift())
- //if the buffer has emptied. emit drain.
- if(!buffer.length && !this.paused)
- this.emit('drain')
- }
-
- stream.resume = function () {
- //this is where I need pauseRead, and pauseWrite.
- //here the reading side is unpaused,
- //but the writing side may still be paused.
- //the whole buffer might not empity at once.
- //it might pause again.
- //the stream should never emit data inbetween pause()...resume()
- //and write should return !buffer.length
-
- this.paused = false
-// process.nextTick(this.drain.bind(this)) //will emit drain if buffer empties.
- this.drain()
- return this
- }
-
- stream.destroy = function () {
- if(destroyed) return
- destroyed = ended = true
- buffer.length = 0
- this.emit('close')
- }
-
- stream.pause = function () {
- stream.paused = true
- return this
- }
-
- return stream
-}
@@ -1,38 +0,0 @@
-{
- "name": "pause-stream",
- "version": "0.0.4",
- "description": "a ThroughStream that strictly buffers all readable events when paused.",
- "main": "index.js",
- "directories": {
- "test": "test"
- },
- "devDependencies": {
- "stream-spec": "~0.2.0"
- },
- "scripts": {
- "test": "node test/index.js && node test/pause-end.js"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/dominictarr/pause-stream.git"
- },
- "keywords": [
- "stream",
- "pipe",
- "pause",
- "drain",
- "buffer"
- ],
- "author": {
- "name": "Dominic Tarr",
- "email": "dominic.tarr@gmail.com",
- "url": "dominictarr.com"
- },
- "license": [
- "MIT",
- "Apache2"
- ],
- "readme": "# PauseStream\n\nThis is a `Stream` that will strictly buffer when paused.\nConnect it to anything you need buffered.\n\n``` js\n var ps = require('pause-stream')();\n\n badlyBehavedStream.pipe(ps.pause())\n\n aLittleLater(function (err, data) {\n ps.pipe(createAnotherStream(data))\n ps.resume()\n })\n```\n\n`PauseStream` will buffer whenever paused.\nit will buffer when yau have called `pause` manually.\nbut also when it's downstream `dest.write()===false`.\nit will attempt to drain the buffer when you call resume\nor the downstream emits `'drain'`\n\n`PauseStream` is tested using [stream-spec](https://github.com/dominictarr/stream-spec)\nand [stream-tester](https://github.com/dominictarr/stream-tester)\n",
- "_id": "pause-stream@0.0.4",
- "_from": "pause-stream"
-}
@@ -1,24 +0,0 @@
-# PauseStream
-
-This is a `Stream` that will strictly buffer when paused.
-Connect it to anything you need buffered.
-
-``` js
- var ps = require('pause-stream')();
-
- badlyBehavedStream.pipe(ps.pause())
-
- aLittleLater(function (err, data) {
- ps.pipe(createAnotherStream(data))
- ps.resume()
- })
-```
-
-`PauseStream` will buffer whenever paused.
-it will buffer when yau have called `pause` manually.
-but also when it's downstream `dest.write()===false`.
-it will attempt to drain the buffer when you call resume
-or the downstream emits `'drain'`
-
-`PauseStream` is tested using [stream-spec](https://github.com/dominictarr/stream-spec)
-and [stream-tester](https://github.com/dominictarr/stream-tester)
@@ -1,17 +0,0 @@
-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(100) //1k random numbers
- .pipe(master = tester.createConsistentStream())
- .pipe(tester.createUnpauseStream())
- .pipe(ps)
- .pipe(tester.createPauseStream())
- .pipe(master.createSlave())
-
Oops, something went wrong.

0 comments on commit fef3e02

Please sign in to comment.