| 255 | } |
| 256 | |
| 257 | async #copyFile(src, dest) { |
| 258 | const destPath = Path.join(dest, Path.basename(src)); |
| 259 | const tempFile = this.#getLocalname(src); |
| 260 | |
| 261 | // Download source file |
| 262 | await new Promise((resolve, reject) => { |
| 263 | sftp.getFile(this.#safeName(src), tempFile, resolve, reject); |
| 264 | }); |
| 265 | |
| 266 | // Upload |
| 267 | await new Promise((resolve, reject) => { |
| 268 | sftp.putFile(this.#safeName(destPath), tempFile, resolve, reject); |
| 269 | }); |
| 270 | |
| 271 | // Clean up temp file |
| 272 | try { |
| 273 | await internalFs.delete(tempFile); |
| 274 | } catch (error) { |
| 275 | console.warn("Failed to cleanup temp file:", error); |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | async #copyDirectory(src, dest) { |
| 280 | // Create destination directory |