From 1ef99281d6a9aa64e4d782e2554dcab791aa7707 Mon Sep 17 00:00:00 2001 From: Andriy Date: Thu, 2 Jul 2026 14:16:49 +0300 Subject: [PATCH] solution --- src/app.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/app.js b/src/app.js index ad9a93a..4f4960a 100644 --- a/src/app.js +++ b/src/app.js @@ -1 +1,27 @@ 'use strict'; + +const fs = require('node:fs/promises'); + +async function main() { + const [, , source, dest] = process.argv; + + if (!source || !dest) { + // eslint-disable-next-line no-console + console.error('Source and destination paths are required'); + + return; + } + + if (source === dest) { + return; + } + + try { + await fs.copyFile(source, dest); + } catch (error) { + // eslint-disable-next-line no-console + console.error(error); + } +} + +main();