1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-02-17 11:30:02 +00:00

Improve buffer allocation for copying files in utils/filesystem.js

This commit is contained in:
Jermolene 2014-12-18 21:08:14 +00:00
parent d2c4920ba4
commit 2abc5dee78

View File

@ -52,9 +52,13 @@ exports.copyDirectory = function(srcPath,dstPath) {
Copy a file
*/
var FILE_BUFFER_LENGTH = 64 * 1024,
fileBuffer = $tw.node && new Buffer(FILE_BUFFER_LENGTH);
fileBuffer;
exports.copyFile = function(srcPath,dstPath) {
// Create buffer if required
if(!fileBuffer) {
fileBuffer = new Buffer(FILE_BUFFER_LENGTH);
}
// Create any directories in the destination
$tw.utils.createDirectory(path.dirname(dstPath));
// Copy the file