| 40 | } |
| 41 | |
| 42 | export async function moveDirectory(from: string, to: string): Promise<void> { |
| 43 | await rimraf(to); |
| 44 | await createDir(to); |
| 45 | |
| 46 | for (const entry of await fs.readdir(from)) { |
| 47 | const fromEntry = join(from, entry); |
| 48 | const toEntry = join(to, entry); |
| 49 | if ((await fs.stat(fromEntry)).isFile()) { |
| 50 | await copyFile(fromEntry, toEntry); |
| 51 | } else { |
| 52 | await moveDirectory(fromEntry, toEntry); |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | export function writeMultipleFiles(fs: { [path: string]: string }) { |
| 58 | return Promise.all(Object.keys(fs).map((fileName) => writeFile(fileName, fs[fileName]))); |