【问题标题】:Copying large number of directories with Node?使用 Node 复制大量目录?
【发布时间】:2018-05-03 09:40:18
【问题描述】:

我开发了一个SuperflyCSS CLI 命令行实用程序,它所做的一件事是使用sfc dist 命令将所有目录和文件从src/main/css 复制到dist。用于复制的Node包为copy-dir,运行命令为require('copy-dir').sync(PLI.src.main.css, PLI.DIST);

然后我开发了一个脚本,它为所有 google 字体以各种字体粗细构建 css 实用程序,并为每种字体以特定字体粗细生成 176691 个目录。每个目录中都有一个小文件。 This is the script 生成目录和对应的文件。

看来Ubuntu's cp command 和我在 Node 中使用的实用程序都很难复制这么多目录。所以我正在为 Node.js 寻找类似“rsync”的解决方案。想法?

【问题讨论】:

    标签: javascript node.js


    【解决方案1】:

    recursive-copy 包处理它。最终像这样使用它:

        rcopy(PLI.src.main.css, PLI.DIST, function(error, results) {
            if (error) {
                console.error('Prepublished command failed: ' + error);
            } else {
                console.info('Prepublished ' + results.length + ' files');
            }
        });
    

    【讨论】:

      猜你喜欢
      • 2016-09-14
      • 2015-10-16
      • 1970-01-01
      • 2011-02-01
      • 2012-06-16
      • 1970-01-01
      • 2013-09-27
      • 2018-07-24
      • 2014-07-14
      相关资源
      最近更新 更多