(fp)
| 397 | var box = require("core/box"); |
| 398 | |
| 399 | var doSync = function(fp) { |
| 400 | var path = fp.path(); |
| 401 | if (isIgnoredFile(path)) return Q(); |
| 402 | |
| 403 | logger.log("sync:box->local:", path); |
| 404 | |
| 405 | if (fp.isDirectory()) { |
| 406 | // Create the directory |
| 407 | return createDirectory(path).then(function() { |
| 408 | // List subfiles |
| 409 | return fp.listdir(); |
| 410 | }).then(function(files) { |
| 411 | // Recursively sync files and directory |
| 412 | return Q.all(_.map(files, function(f) { |
| 413 | return doSync(f); |
| 414 | })); |
| 415 | }); |
| 416 | } else { |
| 417 | // Read file content |
| 418 | return fp.read().then(function(content) { |
| 419 | // Write file content |
| 420 | return writeFile(path, content); |
| 421 | }); |
| 422 | } |
| 423 | }; |
| 424 | return operations.start("files.sync.download", function(op) { |
| 425 | logger.warn("Start sync: box->local"); |
| 426 |
no test coverage detected