Giter VIP home page Giter VIP logo

copy-dir's People

Contributors

pillys avatar roaders avatar xahon avatar zerodragon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

copy-dir's Issues

Publish latest?

Is it possible to publish the latest to NPM? The package on NPM is two years out of date and doesn't include #8, which was merged in last year.

no such file or directory

Hello!
when I use copydir.sync(source, dest); my source directory only has file no folder, then it run error: no such file or directory; but I add a empty folder to source directory ,it run ok ... can it only copy files?
Thanks!

File Permissions

Copied files seem to be assigned 644 permissions on ubuntu 16.04. Both the source directory and target parent folder are 755.

Is there a workaround for this?

Difference compared to fs-extra?

The package fs-extra provides a copy method that seems to do what this package does, and more.

I'm asking this because it is desirable if the ecosystem is clean and free from redundancies. Consider removing this package if it doesn't bring anything new. Alternatively merge with fs-extra.

I'm not affiliated with fs-extra or anything like this. It just seems fs-extra is the de-facto standard for enhanced fs operations.

how to completely overwrite

when copying folder, its not deleting the previous files, is there any way to avoid merge and overwrite the folder

Typescript definitions

Any chance of getting a index.d.ts file for this project, so we can use it with TypeScript?

I'm happy to help with this - I'd imagine the typings would look similar to cross-spawns in terms of export (the actual function definition would be different of course).

Transform content

I just implemented a similar private library that allows to transform the content of a file.

(recursively)

  1. read source
  2. target = transform source
  3. write target

I would like to switch to yours. Do you think content transformation is something that would fit into your library?

The main idea is to optionally have a transform argument, like this (in TypeScript to make types clear):

const options = {
    transform: (data: string) => string = ...
};

copydir("from", "to", options, ...);

Undocumented changing of args for filter in v1

The readme has the filter looking like this:

function(stat, filepath, filename){

However, in v1 this has changed to be:

function(stat, filepath, filedirectory){

This is a pretty breaking change, and one that is completely undocumented.

(First run is using v1.1.0, second is the same file with v0.4.0)

ss+(2019-05-17+at+10 01 29)

Incorrect error handling

You are missing error handling inside the tools.find call here:

  tools.find(function(err, list) {
    var dirs = list.dirs.map(function(v) { // right here, where are you checking whether "err" exists? You aren't.
      return path.join(tools.to, path.relative(tools.from, v));
    }).concat([tools.to]);
    tools.mkdir(dirs, function(err) {
      tools.copyfile(list.files, callback);
    });
  });

In this call within my code, an error is happening, but your code does not handle the error, it just ignores it. This results in a fatal error because list is undefined.

about the filter

I want to copy some directories with files in it ,beacause I just need the Content folder and Scripts Folder,So I write it like this:

copyDir.sync(copyDirOrFilePath,mkdirpath,function (stat, filepath, filename) {
        if (stat==="directory"&&(filename ==="Content"||filename==="Scripts")) {
            return true;
        }
    }
        return false;
    })

after I run gulp task , the Folder is copied, but files in Folder are not copy.

Is Copy Operation Atomic?

Is the copy operation (copydirSync or/and copydir ) here atomic?

If yes, is it at the directory level or file level?

npm error

No compatible version found: [email protected]

error Windows_NT 6.1.7601
error argv "C:\Program Files\nodejs\node.exe" "C:\Users\yangyong\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "copy-dir"
error node v4.4.7
error npm v3.10.5
error No compatible version found: [email protected]
error Valid install targets:
error 0.3.0, 0.2.0, 0.1.0, 0.0.8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.