source: trip-planner-front/node_modules/fast-glob/out/providers/async.js@ 59329aa

Last change on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1013 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const stream_1 = require("../readers/stream");
4const provider_1 = require("./provider");
5class ProviderAsync extends provider_1.default {
6 constructor() {
7 super(...arguments);
8 this._reader = new stream_1.default(this._settings);
9 }
10 read(task) {
11 const root = this._getRootDirectory(task);
12 const options = this._getReaderOptions(task);
13 const entries = [];
14 return new Promise((resolve, reject) => {
15 const stream = this.api(root, task, options);
16 stream.once('error', reject);
17 stream.on('data', (entry) => entries.push(options.transform(entry)));
18 stream.once('end', () => resolve(entries));
19 });
20 }
21 api(root, task, options) {
22 if (task.dynamic) {
23 return this._reader.dynamic(root, options);
24 }
25 return this._reader.static(task.patterns, options);
26 }
27}
28exports.default = ProviderAsync;
Note: See TracBrowser for help on using the repository browser.