summaryrefslogtreecommitdiff
path: root/lib/fs.js
diff options
context:
space:
mode:
authorShigeki Ohtsu <ohtsu@iij.ad.jp>2013-01-05 01:05:27 +0900
committerBen Noordhuis <info@bnoordhuis.nl>2013-01-04 19:00:16 +0100
commit829f96badad44943ebb8540866d8695e17eb6d05 (patch)
tree03eea2402cc6677b21114de5a0e87362b757ed35 /lib/fs.js
parent93591a2a8832dddc3c7627e502799d42d462235f (diff)
downloadnodejs-829f96badad44943ebb8540866d8695e17eb6d05.tar.gz
nodejs-829f96badad44943ebb8540866d8695e17eb6d05.tar.bz2
nodejs-829f96badad44943ebb8540866d8695e17eb6d05.zip
fs: pool size coincide with ReadStream bufferSize
pool size of file reading in ReadableStream can be adjustable with a bufferSize option.
Diffstat (limited to 'lib/fs.js')
-rw-r--r--lib/fs.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 137b95ff0..94c4a503f 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -38,7 +38,6 @@ var Readable = Stream.Readable;
var Writable = Stream.Writable;
var kMinPoolSpace = 128;
-var kPoolSize = 40 * 1024;
var O_APPEND = constants.O_APPEND || 0;
var O_CREAT = constants.O_CREAT || 0;
@@ -1370,8 +1369,8 @@ fs.realpath = function realpath(p, cache, cb) {
var pool;
-function allocNewPool() {
- pool = new Buffer(kPoolSize);
+function allocNewPool(poolSize) {
+ pool = new Buffer(poolSize);
pool.used = 0;
}
@@ -1468,7 +1467,7 @@ ReadStream.prototype._read = function(n, cb) {
// discard the old pool. Can't add to the free list because
// users might have refernces to slices on it.
pool = null;
- allocNewPool();
+ allocNewPool(this._readableState.bufferSize);
}
// Grab another reference to the pool in the case that while we're