(
rawPath: string,
content: FileContent,
encoding?: BufferEncoding,
mode?: number,
mtime?: Date
)
| 618 | // ── Mutation helpers ─────────────────────────────────────────────── |
| 619 | |
| 620 | private insertContent( |
| 621 | rawPath: string, |
| 622 | content: FileContent, |
| 623 | encoding?: BufferEncoding, |
| 624 | mode?: number, |
| 625 | mtime?: Date |
| 626 | ): void { |
| 627 | validatePath(rawPath, "write"); |
| 628 | const segs = split(normalizePath(rawPath)); |
| 629 | if (segs.length === 0) { |
| 630 | throw new Error( |
| 631 | `EISDIR: illegal operation on a directory, write '${rawPath}'` |
| 632 | ); |
| 633 | } |
| 634 | const parent = this.scaffold(segs); |
| 635 | parent.children.set(segs[segs.length - 1], { |
| 636 | kind: "file", |
| 637 | bytes: toBuffer(content, encoding), |
| 638 | mode: mode ?? DEFAULT_FILE_MODE, |
| 639 | mtime: mtime ?? new Date() |
| 640 | }); |
| 641 | } |
| 642 | |
| 643 | private insertLazy( |
| 644 | rawPath: string, |
no test coverage detected