fix: statfs when volume is not mounted

This commit is contained in:
Nicolas Meienberger
2025-09-25 21:28:36 +02:00
parent 6b386d28d6
commit 9b57dd8a1c
4 changed files with 52 additions and 5 deletions

View File

@@ -6,6 +6,12 @@ type MountInfo = {
fstype: string;
};
export type StatFs = {
total: number;
used: number;
free: number;
};
function isPathWithin(base: string, target: string): boolean {
const rel = path.posix.relative(base, target);
return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));