vscode#FileStat TypeScript Examples
The following examples show how to use
vscode#FileStat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: driveFileSystemProvider.ts From google-drive-vscode with MIT License | 6 votes |
stat(uri: Uri): FileStat | Thenable<FileStat> {
return new Promise((resolve, reject) => {
const fileId = uri.fragment;
const driveFile = this.model.getDriveFile(fileId);
if (driveFile) {
const fileStat = this.buildFileStat(driveFile);
resolve(fileStat);
} else {
reject('File not found');
}
});
}
Example #2
Source File: driveFileSystemProvider.ts From google-drive-vscode with MIT License | 6 votes |
private buildFileStat(driveFile: DriveFile): FileStat {
const vscodeType = this.detectFileType(driveFile);
const fileStat = {
type: vscodeType,
ctime: driveFile.createdTime,
mtime: driveFile.modifiedTime,
size: driveFile.size,
};
return fileStat;
}
Example #3
Source File: utopia-fs.ts From utopia with MIT License | 6 votes |
async stat(uri: Uri): Promise<FileStat> {
const path = fromUtopiaURI(uri)
const stats = await stat(path)
const fileType = isDirectory(stats) ? FileType.Directory : FileType.File
return {
type: fileType,
ctime: stats.ctime.valueOf(),
mtime: stats.lastSavedTime.valueOf(), // VS Code is only interested in changes to the saved content
size: stats.size,
}
}
Example #4
Source File: VirtualFileSystemProvider.ts From vscode-drawio with GNU General Public License v3.0 | 6 votes |
stat(uri: Uri): FileStat {
const f = this.getOrCreateFile(uri).file;
return {
type: FileType.File,
ctime: 0,
mtime: 0,
size: f.data.length,
};
}
Example #5
Source File: path.ts From vscode-file-browser with GNU Lesser General Public License v3.0 | 5 votes |
async stat(): Promise<Result<FileStat, Error>> {
return Result.try(vscode.workspace.fs.stat(this.pathUri));
}