stat method
- String path,
- {EntityType type = EntityType.file}
override
Implementation
@override
Stat stat(
String path, {
EntityType type = EntityType.file,
}) {
final nPath = join(root.path, path);
if (type == EntityType.file) {
io.FileStat stat = io.File(nPath).statSync();
return FileStat(
path: path,
relativePath: nPath,
type: type,
size: stat.size,
created: stat.modified,
changed: stat.changed,
);
} else if (type == EntityType.dir) {
io.FileStat stat = io.Directory(nPath).statSync();
return DirStat(
path: path,
relativePath: nPath,
type: type,
size: stat.size,
created: stat.modified,
count: Future.sync(() async {
int count = 0;
await for (final entity in io.Directory(nPath).list(
recursive: true,
)) {
if (entity is io.File) {
count++;
}
}
return count;
}),
);
}
throw "[Native filesystem] unsupported format!";
}