( args: ReadAttachmentFromPathArgs, resolvedPath: string )
| 136 | } |
| 137 | |
| 138 | async 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 | |
| 156 | async function readRegularFileBytes( |
| 157 | args: ReadAttachmentFromPathArgs, |
no test coverage detected