26c940db17fc6c8d753761f79bc94520992af6ae
[yaffs-website] / buffer.js
1 var through = require('through2');
2
3 module.exports = function(fn) {
4   var buf = [];
5   var end = function(cb) {
6     this.push(buf);
7     cb();
8     if(fn) fn(null, buf);
9   };
10   var push = function(data, enc, cb) {
11     buf.push(data);
12     cb();
13   };
14   return through.obj(push, end);
15 };