Closed nfroidure closed 9 years ago
Something like that in the Vinyl setters of https://github.com/nfroidure/vinyl/blob/master/index.js#L119 :
(function(cache) { Object.defineProperty(File.prototype, 'contents', { get: function() { return cache || (cache = Fs.readFileSync(this.path)); }, set: function(value) { cache = value; } }); })(null)
So it would read files only when required. Another way of moving null contents out of Vinyl.
A side effect: https://github.com/gulpjs/gulp/issues/79#issuecomment-31580992
the readFile is non-blocking right now though. If I spin up a glob that has 200 files it will be faster currently than it would be if we added this
Something like that in the Vinyl setters of https://github.com/nfroidure/vinyl/blob/master/index.js#L119 :
So it would read files only when required. Another way of moving null contents out of Vinyl.
A side effect: https://github.com/gulpjs/gulp/issues/79#issuecomment-31580992