MCPcopy
hub / github.com/coder/mux / statRegularFile

Function statRegularFile

src/node/utils/attachments/readAttachmentFromPath.ts:138–154  ·  view source on GitHub ↗
(
  args: ReadAttachmentFromPathArgs,
  resolvedPath: string
)

Source from the content-addressed store, hash-verified

136}
137
138async function statRegularFile(
139 args: ReadAttachmentFromPathArgs,
140 resolvedPath: string
141): Promise<FileStat> {
142 let fileStat: FileStat;
143 try {
144 fileStat = await args.runtime.stat(resolvedPath, args.abortSignal);
145 } catch (error) {
146 throw buildMissingFileError(resolvedPath, error);
147 }
148
149 if (fileStat.isDirectory) {
150 throw new Error(`Path is a directory, not a file: ${resolvedPath}`);
151 }
152
153 return fileStat;
154}
155
156async function readRegularFileBytes(
157 args: ReadAttachmentFromPathArgs,

Callers 1

readAttachFileFromPathFunction · 0.85

Calls 2

buildMissingFileErrorFunction · 0.85
statMethod · 0.65

Tested by

no test coverage detected