From 898c096a0fe7806af449af2280b7367930895c85 Mon Sep 17 00:00:00 2001 From: Boof <97455552+hexahigh@users.noreply.github.com> Date: Mon, 20 Mar 2023 09:35:11 +0100 Subject: [PATCH] create node.js copy --- js/copyAndMove.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 js/copyAndMove.js diff --git a/js/copyAndMove.js b/js/copyAndMove.js new file mode 100644 index 0000000..6b6a5e3 --- /dev/null +++ b/js/copyAndMove.js @@ -0,0 +1,18 @@ +const fs = require('fs') + +var AX = {} + +AX.copy = function (source, output) { + //var SBuff = fs.readFileSync(source) + fs.writeFileSync(output, fs.readFileSync(source), function (err) { + if (err) throw err + console.log('Successfully copied file!') + }) +} + +AX.move = function (source, destination) { + fs.rename(source, destination, function (err) { + if (err) throw err + console.log('Successfully moved - AKA renamed!') + }) +} \ No newline at end of file