Skip to content

Commit a7f2804

Browse files
Added task
1 parent ff435f3 commit a7f2804

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/app.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
11
'use strict';
2+
3+
const fs = require('node:fs');
4+
5+
function main(from, to) {
6+
if (!from || !to) {
7+
// eslint-disable-next-line no-console
8+
console.error('Two file paths are required');
9+
10+
return;
11+
}
12+
13+
if (from === to) {
14+
return;
15+
}
16+
17+
fs.cp(from, to, (error) => {
18+
if (error) {
19+
// eslint-disable-next-line no-console
20+
console.error(error.message);
21+
}
22+
});
23+
}
24+
25+
const params = process.argv.slice(2);
26+
27+
const fileFrom = params[0];
28+
const fileTo = params[1];
29+
30+
main(fileFrom, fileTo);

src/text1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello dildo

0 commit comments

Comments
 (0)