@@ -106,35 +106,26 @@ export class WebAccessFS extends Async(IndexFS) {
106106 }
107107
108108 async stat ( path : string ) : Promise < Inode > {
109- try {
110- return await super . stat ( path ) ;
111- } catch ( ex : any ) {
112- if ( ex . code != 'ENOENT' ) throw ex ;
113-
114- // This handle must have been created after initialization
115- // Try to add a new inode for the handle to the index
109+ const handle = await this . get ( null , path ) ;
110+ const inode = new Inode ( ) ;
116111
117- const handle = await this . get ( null , path ) ;
118- const inode = new Inode ( ) ;
119-
120- if ( isKind ( handle , 'file' ) ) {
121- const file = await handle . getFile ( ) ;
122- inode . update ( {
123- mode : 0o644 | constants . S_IFREG ,
124- size : file . size ,
125- mtimeMs : file . lastModified ,
126- } ) ;
127- } else {
128- inode . update ( {
129- mode : constants . S_IFDIR | 0o777 ,
130- size : 0 ,
131- } ) ;
132- }
112+ if ( isKind ( handle , 'file' ) ) {
113+ const file = await handle . getFile ( ) ;
114+ inode . update ( {
115+ mode : 0o644 | constants . S_IFREG ,
116+ size : file . size ,
117+ mtimeMs : file . lastModified ,
118+ } ) ;
119+ } else {
120+ inode . update ( {
121+ mode : constants . S_IFDIR | 0o777 ,
122+ size : 0 ,
123+ } ) ;
124+ }
133125
134- this . index . set ( path , inode ) ;
126+ this . index . set ( path , inode ) ;
135127
136- return inode ;
137- }
128+ return inode ;
138129 }
139130
140131 async readdir ( path : string ) : Promise < string [ ] > {
0 commit comments