Version 0.4.0 - Ajout des metrics
All checks were successful
Neutral/pipeline/head This commit looks good
All checks were successful
Neutral/pipeline/head This commit looks good
This commit is contained in:
27
bin/files.js
27
bin/files.js
@ -6,7 +6,7 @@ const clog = new LogType("Fichier")
|
||||
const os = require("os");
|
||||
const uuid = require('uuid');
|
||||
var mime = require('mime-types');
|
||||
const { set } = require("../main")
|
||||
|
||||
|
||||
// check if shared folder exist, if not create it
|
||||
if(!fs.existsSync(__glob.SHARED)) {
|
||||
@ -229,4 +229,27 @@ module.exports.newFile = function(settings) {
|
||||
|
||||
return "EXIST"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.pasteFile = function(settings) {
|
||||
if(settings.action == "cut") {
|
||||
|
||||
try {
|
||||
|
||||
fs.renameSync(settings.file.fileDirectory, settings.newPath + path.sep + settings.name)
|
||||
return "OK"
|
||||
} catch(err) {
|
||||
console.log(err)
|
||||
return "NOT_PERMITTED"
|
||||
}
|
||||
} else if(settings.action == "copy") {
|
||||
|
||||
try {
|
||||
fs.copyFileSync(settings.file.fileDirectory, settings.newPath + path.sep + settings.name)
|
||||
return "OK"
|
||||
} catch(err) {
|
||||
console.log(err)
|
||||
return "NOT_PERMITTED"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user