(sessionId: string, req: FsMkdirRequest)
| 329 | } |
| 330 | |
| 331 | async mkdir(sessionId: string, req: FsMkdirRequest): Promise<FsEntry> { |
| 332 | const session = await this.sessions.get(sessionId); |
| 333 | const cwd = session.metadata.cwd; |
| 334 | const safe = await resolveSafePath(cwd, req.path); |
| 335 | |
| 336 | try { |
| 337 | await fs.mkdir(safe.absolute, { recursive: req.recursive }); |
| 338 | } catch (err) { |
| 339 | const code = (err as NodeJS.ErrnoException).code; |
| 340 | if (code === 'EEXIST') { |
| 341 | throw new FsAlreadyExistsError(req.path); |
| 342 | } |
| 343 | if (code === 'ENOENT' || code === 'ENOTDIR') { |
| 344 | // Non-recursive mkdir whose parent is missing / not a directory. |
| 345 | throw new FsPathNotFoundError(req.path); |
| 346 | } |
| 347 | throw err; |
| 348 | } |
| 349 | |
| 350 | const st = await fs.stat(safe.absolute); |
| 351 | const name = path.basename(safe.absolute); |
| 352 | return buildFsEntryFromStat(safe.relative, name, safe.absolute, st, false); |
| 353 | } |
| 354 | |
| 355 | async resolveDownload( |
| 356 | sessionId: string, |
nothing calls this directly
no test coverage detected