format: prettify entire project
This commit is contained in:
30
node_modules/stream-meter/index.js
generated
vendored
30
node_modules/stream-meter/index.js
generated
vendored
@ -1,27 +1,29 @@
|
||||
module.exports = Meter
|
||||
module.exports = Meter;
|
||||
|
||||
var util = require("util")
|
||||
var util = require('util');
|
||||
|
||||
var Transform = require("stream").Transform
|
||||
var Transform = require('stream').Transform;
|
||||
|
||||
if (!Transform) {
|
||||
Transform = require("readable-stream/transform")
|
||||
Transform = require('readable-stream/transform');
|
||||
}
|
||||
|
||||
function Meter(maxBytes) {
|
||||
if (!(this instanceof Meter)) return new Meter(maxBytes)
|
||||
Transform.call(this)
|
||||
if (!(this instanceof Meter)) return new Meter(maxBytes);
|
||||
Transform.call(this);
|
||||
|
||||
this.bytes = 0
|
||||
this.maxBytes = maxBytes || Number.MAX_VALUE
|
||||
this.bytes = 0;
|
||||
this.maxBytes = maxBytes || Number.MAX_VALUE;
|
||||
}
|
||||
util.inherits(Meter, Transform)
|
||||
util.inherits(Meter, Transform);
|
||||
|
||||
Meter.prototype._transform = function (chunk, encoding, cb) {
|
||||
this.bytes += chunk.length
|
||||
this.push(chunk)
|
||||
this.bytes += chunk.length;
|
||||
this.push(chunk);
|
||||
if (this.bytes > this.maxBytes) {
|
||||
return cb(new Error("Stream exceeded specified max of " + this.maxBytes + " bytes."))
|
||||
return cb(
|
||||
new Error('Stream exceeded specified max of ' + this.maxBytes + ' bytes.')
|
||||
);
|
||||
}
|
||||
cb()
|
||||
}
|
||||
cb();
|
||||
};
|
||||
|
Reference in New Issue
Block a user