`path.resolve` + symlink resolution, falling back when the path is missing.
(dir: string)
| 354 | |
| 355 | /** `path.resolve` + symlink resolution, falling back when the path is missing. */ |
| 356 | function realpath(dir: string): string { |
| 357 | const resolved = path.resolve(dir); |
| 358 | try { |
| 359 | return fs.realpathSync(resolved); |
| 360 | } catch { |
| 361 | return resolved; |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | /** |
| 366 | * Bound and de-fang an attacker-supplied header before echoing it back. |
no test coverage detected