1 | "use strict";
|
2 |
|
3 | let util = require("util");
|
4 | let ChunkStream = require("./chunkstream");
|
5 | let Filter = require("./filter-parse");
|
6 |
|
7 | let FilterAsync = (module.exports = function (bitmapInfo) {
|
8 | ChunkStream.call(this);
|
9 |
|
10 | let buffers = [];
|
11 | let that = this;
|
12 | this._filter = new Filter(bitmapInfo, {
|
13 | read: this.read.bind(this),
|
14 | write: function (buffer) {
|
15 | buffers.push(buffer);
|
16 | },
|
17 | complete: function () {
|
18 | that.emit("complete", Buffer.concat(buffers));
|
19 | },
|
20 | });
|
21 |
|
22 | this._filter.start();
|
23 | });
|
24 | util.inherits(FilterAsync, ChunkStream);
|