MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / stat

Method stat

services/app-builder/src/git/memfs.ts:63–128  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

61 }
62
63 async stat(path: string): Promise<{
64 type: 'file' | 'dir';
65 mode: number;
66 size: number;
67 mtimeMs: number;
68 ino: number;
69 uid: number;
70 gid: number;
71 dev: number;
72 ctime: Date;
73 mtime: Date;
74 ctimeMs: number;
75 isFile: () => boolean;
76 isDirectory: () => boolean;
77 isSymbolicLink: () => boolean;
78 }> {
79 const normalized = path.startsWith('/') ? path.slice(1) : path;
80
81 const data = this.files.get(normalized);
82 if (data) {
83 return {
84 type: 'file' as const,
85 mode: 0o100644,
86 size: data.length,
87 mtimeMs: Date.now(),
88 ino: 0,
89 uid: 0,
90 gid: 0,
91 dev: 0,
92 ctime: new Date(),
93 mtime: new Date(),
94 ctimeMs: Date.now(),
95 isFile: () => true,
96 isDirectory: () => false,
97 isSymbolicLink: () => false,
98 };
99 }
100
101 const prefix = normalized ? normalized + '/' : '';
102 for (const filePath of this.files.keys()) {
103 if (filePath.startsWith(prefix)) {
104 return {
105 type: 'dir' as const,
106 mode: 0o040755,
107 size: 0,
108 mtimeMs: Date.now(),
109 ino: 0,
110 uid: 0,
111 gid: 0,
112 dev: 0,
113 ctime: new Date(),
114 mtime: new Date(),
115 ctimeMs: Date.now(),
116 isFile: () => false,
117 isDirectory: () => true,
118 isSymbolicLink: () => false,
119 };
120 }

Callers 3

lstatMethod · 0.95
existsFunction · 0.45
initializeFSMethod · 0.45

Calls 1

getMethod · 0.65

Tested by

no test coverage detected