summaryrefslogtreecommitdiff
path: root/lib/stream.js
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-12-01 20:59:06 -0800
committerRyan Dahl <ry@tinyclouds.org>2010-12-01 20:59:06 -0800
commitdd53ceebe4e87ed2c71486e17cdcd33af88cec59 (patch)
tree436f09d076c79be675741e64283dc7a07c0aee7f /lib/stream.js
parente232f6e7356531bb6ab50cdf9c82386538ae2c79 (diff)
downloadandroid-node-v8-dd53ceebe4e87ed2c71486e17cdcd33af88cec59.tar.gz
android-node-v8-dd53ceebe4e87ed2c71486e17cdcd33af88cec59.tar.bz2
android-node-v8-dd53ceebe4e87ed2c71486e17cdcd33af88cec59.zip
lint
Diffstat (limited to 'lib/stream.js')
-rw-r--r--lib/stream.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/stream.js b/lib/stream.js
index 5c6cab905a..98f0c37fcb 100644
--- a/lib/stream.js
+++ b/lib/stream.js
@@ -7,22 +7,22 @@ function Stream() {
util.inherits(Stream, events.EventEmitter);
exports.Stream = Stream;
-Stream.prototype.pipe = function (dest, options) {
+Stream.prototype.pipe = function(dest, options) {
var source = this;
- function ondata (chunk) {
+ function ondata(chunk) {
if (dest.writable) {
if (false === dest.write(chunk)) source.pause();
}
}
- source.on("data", ondata);
+ source.on('data', ondata);
- function ondrain () {
+ function ondrain() {
if (source.readable) source.resume();
}
- dest.on("drain", ondrain);
+ dest.on('drain', ondrain);
/*
* If the 'end' option is not supplied, dest.end() will be called when
@@ -30,14 +30,14 @@ Stream.prototype.pipe = function (dest, options) {
*/
if (!options || options.end !== false) {
- function onend () {
+ function onend() {
dest.end();
}
- source.on("end", onend);
+ source.on('end', onend);
}
- dest.on('close', function () {
+ dest.on('close', function() {
source.removeListener('data', ondata);
dest.removeListener('drain', ondrain);
source.removeListener('end', onend);
@@ -49,22 +49,22 @@ Stream.prototype.pipe = function (dest, options) {
*/
if (!source.pause) {
- source.pause = function () {
- source.emit("pause");
+ source.pause = function() {
+ source.emit('pause');
};
}
if (!source.resume) {
- source.resume = function () {
- source.emit("resume");
+ source.resume = function() {
+ source.emit('resume');
};
}
- dest.on("pause", function () {
+ dest.on('pause', function() {
source.pause();
});
- dest.on("resume", function () {
+ dest.on('resume', function() {
if (source.readable) source.resume();
});
};