Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit f8b7aae

Browse files
Use sync version of fs.lstat
1 parent d5c663a commit f8b7aae

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

declarations.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,13 @@ interface IFileSystem {
301301
*/
302302
getFsStats(path: string): IFsStats;
303303

304-
getLsStats(path: string): IFuture<IFsStats>;
304+
/**
305+
* Returns information about the specified file.
306+
* In case the passed path is symlink, the returned information is about the symlink itself.
307+
* @param {string} path Path to file for which the information will be taken.
308+
* @returns {IFsStats} Inforamation about the specified file.
309+
*/
310+
getLsStats(path: string): IFsStats;
305311

306312
symlink(sourcePath: string, destinationPath: string, type: "file"): void;
307313
symlink(sourcePath: string, destinationPath: string, type: "dir"): void;

file-system.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,8 @@ export class FileSystem implements IFileSystem {
249249
return fs.statSync(path);
250250
}
251251

252-
public getLsStats(path: string): IFuture<fs.Stats> {
253-
let future = new Future<fs.Stats>();
254-
fs.lstat(path, (err: Error, data: fs.Stats) => {
255-
if (err) {
256-
future.throw(err);
257-
} else {
258-
future.return(data);
259-
}
260-
});
261-
return future;
252+
public getLsStats(path: string): fs.Stats {
253+
return fs.lstatSync(path);
262254
}
263255

264256
public getUniqueFileName(baseName: string): string {

0 commit comments

Comments
 (0)