Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add task solution #356

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
'use strict';

const fs = require('fs');

function copyFiles(source, destination) {
if (!source) {
// eslint-disable-next-line no-console
console.error('No source provided');

return;
}

if (!destination) {
// eslint-disable-next-line no-console
console.error('No destination provided');

return;
}

fs.cp(source, destination, (err) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fs.cp method is not a standard method in Node.js's fs module. You might want to use fs.copyFile or fs.copyFileSync for copying files. Please check the Node.js documentation for the correct method to use.

if (err) {
// eslint-disable-next-line no-console
console.error(err);
}
});
}

copyFiles(...process.argv.slice(2, 4));
Loading