create node.js copy

This commit is contained in:
Boof 2023-03-20 09:35:11 +01:00 committed by GitHub
parent f8c5c2769e
commit 898c096a0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

18
js/copyAndMove.js Normal file
View File

@ -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!')
})
}