Skip to content
This repository was archived by the owner on Jun 24, 2026. It is now read-only.
This repository was archived by the owner on Jun 24, 2026. It is now read-only.

Recursive copy #98

Description

@iansu

Implement a recursive copy command in Node.js. I have been drafting a proposal for this functionality in this document: https://hackmd.io/Q2O7hVyZSKClYW9Vyipeig

At this stage I'd like feedback from the Tooling group on the proposal. Once we're happy with it we can open an issue in the main Node.js repo to get broader feedback. If all goes well we can follow up with an implementation.

Activity

  1. iansu commented on Feb 19, 2021

    @iansu
    ContributorAuthor

    @RyanZim We're considering using the fs-extra recursive copy implementation in Node.js. I'd love your feedback on this proposal and on incorporating part of fs-extra into Node core. cc @CxRes

  2. RyanZim commented on Feb 20, 2021

    @RyanZim

    @manidlou is the collaborator that handles most things related to copy and move in fs-extra; so looping him in here since his feedback is probably most useful here.

    Would you be planning on implementing the filter option as well?

  3. CxRes commented on Feb 20, 2021

    @CxRes

    I am not involved with fs-extra though I use it in my work. And, I find the copy function incredibly useful.

    However, from the point of view of nodejs, I think the copy function as implemented in fs-extra is limited. Don't get me wrong, it is really good for day to day use, its just that recursive copy is a relatively complex operation.

    I would suggest that you consider cp, rsync and Windows Robocopy for inspiration.

    A few things, I would like are:

    • A verbose output as a return value
    • A filter that can take regex and/or glob array (most times I end up importing picomatch)

    Perhaps later you can add:

    • Preserve attributes, permissions and time-stamps
    • interactive mode
  4. manidlou commented on Jul 10, 2021

    @manidlou

    @iansu I just want to remind you that our copy implementation in fs-extra is a bit different than unix cp command.

    For instance, in fs-extra, when copying a file to a different directory, like copy('src-file.js', 'some/dir/dest-file.js') the user requires to explicitly specify the destination file name meaning copy('src-file.js', 'some/dir/') would fail in fs-extra while it works fine in the unix cp command.

    That was a source of confusion for some of our users because they have this assumption that fs-extra functions would work like unix commands (which is a fair assumption since node is very unix-y) but we at fs-extra decided to go with explicitness.

    So probably something that you might want to consider when deciding on the behavior of the function.

  5. added a commit that references this issue on Aug 12, 2021
  6. added a commit that references this issue on Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions