function ProgressBar(options) { options = options || {}; this.cursor = ansi(stream); this.total = options.total || 100; this.current = options.current || 0; this.width = options.width || 60; this.fixedWidth = options.fixedWidth; if (typeof this.width === 'string') { if (endWith(this.width, '%')) { this.width = parseFloat(this.width) / 100 % 1; } else { this.width = parseFloat(this.width); } } this.tough = !!options.tough; this.clean = !!options.clean; this.chars = { blank: options.blank || '—', filled: options.filled || '▇' }; // callback on completed this.callback = options.callback; this.setSchema(options.schema); this.snoop(); instances.push(this); }
.on('file', function (path) { // We can receive here 'path': 'a/b/my-file', 'a/b/bad-my-file', // 'my-file', 'bad-my-file'. // Both 'a/b/my-file' and 'my-file' should be valid. if (path === name || endsWith(path, '/' + name)) { resultPath = path; finder.stop(); } })