File tree Expand file tree Collapse file tree 5 files changed +37
-33
lines changed
Expand file tree Collapse file tree 5 files changed +37
-33
lines changed Original file line number Diff line number Diff line change 1+ import { access } from "fs" ;
2+
3+ export function exists ( path : string ) : Promise < boolean > {
4+ return new Promise ( ( resolve , reject ) => {
5+ access ( path , err => ( err ? reject ( err ) : resolve ( true ) ) ) ;
6+ } ) ;
7+ }
Original file line number Diff line number Diff line change 1+ import { readdir as fsReaddir } from "fs" ;
2+
3+ export function readdir ( path : string ) : Promise < string [ ] > {
4+ return new Promise ( ( resolve , reject ) => {
5+ fsReaddir ( path , ( err , files ) => {
6+ if ( err ) {
7+ reject ( err ) ;
8+ }
9+
10+ resolve ( files ) ;
11+ } ) ;
12+ } ) ;
13+ }
Original file line number Diff line number Diff line change 1+ import { stat as fsStat , Stats } from "fs" ;
2+
3+ export function stat ( filePath : string ) : Promise < Stats > {
4+ return new Promise ( ( resolve , reject ) => {
5+ fsStat ( filePath , ( err , stats ) => {
6+ if ( err ) {
7+ reject ( err ) ;
8+ }
9+
10+ resolve ( stats ) ;
11+ } ) ;
12+ } ) ;
13+ }
Original file line number Diff line number Diff line change @@ -31,7 +31,9 @@ import {
3131 isDescendant ,
3232 normalizePath
3333} from "./util" ;
34- import { exists , readDir , stat } from "./util/async_fs" ;
34+ import { exists } from "./fs/exists" ;
35+ import { readdir } from "./fs/readdir" ;
36+ import { stat } from "./fs/stat" ;
3537import { matchAll } from "./util/globMatch" ;
3638
3739export class Model implements IDisposable {
@@ -336,7 +338,7 @@ export class Model implements IDisposable {
336338 let files : string [ ] | Buffer [ ] = [ ] ;
337339
338340 try {
339- files = await readDir ( path ) ;
341+ files = await readdir ( path ) ;
340342 } catch ( error ) {
341343 return ;
342344 }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments