UNPKG

miniprogram-build

Version:

A command line tool to build & watch MiniProgram.

18 lines (14 loc) 406 B
// https://github.com/andrewrk/node-stream-counter module.exports = ByteCounter; var Writable = require('stream').Writable; var util = require('util'); util.inherits(ByteCounter, Writable); function ByteCounter(options) { Writable.call(this, options); this.bytes = 0; } ByteCounter.prototype._write = function(chunk, encoding, cb) { this.bytes += chunk.length; this.emit('progress'); cb(); };