mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-20 04:50:03 +00:00
Improve buffer allocation for copying files in utils/filesystem.js
This commit is contained in:
parent
d2c4920ba4
commit
2abc5dee78
@ -52,9 +52,13 @@ exports.copyDirectory = function(srcPath,dstPath) {
|
|||||||
Copy a file
|
Copy a file
|
||||||
*/
|
*/
|
||||||
var FILE_BUFFER_LENGTH = 64 * 1024,
|
var FILE_BUFFER_LENGTH = 64 * 1024,
|
||||||
fileBuffer = $tw.node && new Buffer(FILE_BUFFER_LENGTH);
|
fileBuffer;
|
||||||
|
|
||||||
exports.copyFile = function(srcPath,dstPath) {
|
exports.copyFile = function(srcPath,dstPath) {
|
||||||
|
// Create buffer if required
|
||||||
|
if(!fileBuffer) {
|
||||||
|
fileBuffer = new Buffer(FILE_BUFFER_LENGTH);
|
||||||
|
}
|
||||||
// Create any directories in the destination
|
// Create any directories in the destination
|
||||||
$tw.utils.createDirectory(path.dirname(dstPath));
|
$tw.utils.createDirectory(path.dirname(dstPath));
|
||||||
// Copy the file
|
// Copy the file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user