mirror of
https://github.com/leanote/desktop-app.git
synced 2026-01-29 02:07:09 +08:00
sync attach ok
This commit is contained in:
29
node_modules/file.js
generated
vendored
29
node_modules/file.js
generated
vendored
@@ -205,6 +205,35 @@ var File = {
|
||||
});
|
||||
},
|
||||
|
||||
// 下载, 复制一份文件
|
||||
download: function(srcPath, toPath, callback) {
|
||||
var srcIsExists = fs.existsSync(srcPath);
|
||||
if(!srcIsExists) {
|
||||
return callback(false, 'File Not Exists');
|
||||
}
|
||||
console.log(srcPath);
|
||||
console.log(toPath);
|
||||
var toIsExists = fs.existsSync(toPath);
|
||||
function cp() {
|
||||
Common.copyFile(srcPath, toPath, function(ok) {
|
||||
callback(ok);
|
||||
});
|
||||
}
|
||||
if(toIsExists) {
|
||||
fs.unlink(toPath, function(error) {
|
||||
if(!error) {
|
||||
cp();
|
||||
} else {
|
||||
callback(false, 'The Target File Cannot Overwrite');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cp();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
// 附件操作
|
||||
addAttach: function(filePaths, noteId, callback) {
|
||||
if(!noteId || !filePaths) {
|
||||
|
||||
Reference in New Issue
Block a user