UNPKG

558 BJavaScriptView Raw
1"use strict";
2
3let util = require("util");
4let ChunkStream = require("./chunkstream");
5let Filter = require("./filter-parse");
6
7let 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});
24util.inherits(FilterAsync, ChunkStream);