From 47e91428bc312c563702e38ae732d78d34fe7b49 Mon Sep 17 00:00:00 2001 From: Sidach Ruslan Date: Mon, 22 Jun 2026 11:05:22 +0300 Subject: [PATCH] add solution --- src/app.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/app.js b/src/app.js index ad9a93a..657ddd1 100644 --- a/src/app.js +++ b/src/app.js @@ -1 +1,22 @@ 'use strict'; + +const fs = require('fs/promises'); + +async function main() { + const [pathFrom, pathTo] = process.argv.slice(2); + + if (pathFrom === pathTo) { + return; + } + + try { + const data = await fs.readFile(pathFrom, 'utf-8'); + + await fs.writeFile(pathTo, data, 'utf-8'); + } catch (e) { + // eslint-disable-next-line no-console + console.error(e); + } +} + +main();