sync attach ok

This commit is contained in:
life
2015-02-09 23:48:47 +08:00
parent b7b5d241f7
commit 22283f22c7
8 changed files with 214 additions and 9 deletions

29
node_modules/file.js generated vendored
View File

@@ -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) {