fix: undefined file stat
This commit is contained in:
		
							parent
							
								
									1e3701e37c
								
							
						
					
					
						commit
						fe310459da
					
				
					 1 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
					@ -68,10 +68,9 @@ export const createDefaultClass = (type: string): ContentFileConstructor => {
 | 
				
			||||||
		async getMtime(): Promise<number> {
 | 
							async getMtime(): Promise<number> {
 | 
				
			||||||
			const oldStat = this.getStat();
 | 
								const oldStat = this.getStat();
 | 
				
			||||||
			if (oldStat !== undefined) return oldStat.mtimeMs;
 | 
								if (oldStat !== undefined) return oldStat.mtimeMs;
 | 
				
			||||||
			await this.getHash();
 | 
								const stat = await promises.stat(this.path);
 | 
				
			||||||
			const newStat = this.getStat();
 | 
								this.stat = stat;
 | 
				
			||||||
			if (newStat === undefined) throw new Error("stat is undefined");
 | 
								return stat.mtimeMs;
 | 
				
			||||||
			return newStat.mtimeMs;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	return cons;
 | 
						return cons;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue