|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
|---|
| 3 | const fsWalk = require("@nodelib/fs.walk");
|
|---|
| 4 | const reader_1 = require("./reader");
|
|---|
| 5 | const stream_1 = require("./stream");
|
|---|
| 6 | class ReaderAsync extends reader_1.default {
|
|---|
| 7 | constructor() {
|
|---|
| 8 | super(...arguments);
|
|---|
| 9 | this._walkAsync = fsWalk.walk;
|
|---|
| 10 | this._readerStream = new stream_1.default(this._settings);
|
|---|
| 11 | }
|
|---|
| 12 | dynamic(root, options) {
|
|---|
| 13 | return new Promise((resolve, reject) => {
|
|---|
| 14 | this._walkAsync(root, options, (error, entries) => {
|
|---|
| 15 | if (error === null) {
|
|---|
| 16 | resolve(entries);
|
|---|
| 17 | }
|
|---|
| 18 | else {
|
|---|
| 19 | reject(error);
|
|---|
| 20 | }
|
|---|
| 21 | });
|
|---|
| 22 | });
|
|---|
| 23 | }
|
|---|
| 24 | async static(patterns, options) {
|
|---|
| 25 | const entries = [];
|
|---|
| 26 | const stream = this._readerStream.static(patterns, options);
|
|---|
| 27 | // After #235, replace it with an asynchronous iterator.
|
|---|
| 28 | return new Promise((resolve, reject) => {
|
|---|
| 29 | stream.once('error', reject);
|
|---|
| 30 | stream.on('data', (entry) => entries.push(entry));
|
|---|
| 31 | stream.once('end', () => resolve(entries));
|
|---|
| 32 | });
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
| 35 | exports.default = ReaderAsync;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.