"Fossies" - the Fresh Open Source Software Archive

Member "node-v12.18.4-win-x86/node_modules/npm/node_modules/copy-concurrently/README.md" (14 Feb 2020, 6280 Bytes) of package /windows/www/node-v12.18.4-win-x86.zip:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.


Copy files, directories and symlinks

const copy = require('copy-concurrently')
copy('/path/to/thing', '/new/path/thing').then(() => {
  // this is now copied
}).catch(err => {
  // oh noooo

Copies files, directories and symlinks. Ownership is maintained when running as root, permissions are always maintained. On Windows, if symlinks are unavailable then junctions will be used.


copy(from, to, [options]) → Promise

Recursively copies from to to and resolves its promise when finished. If to already exists then the promise will be rejected with an EEXIST error.

Options are:

Options can also include dependency injection:


Ordinarily you’d only call copy above. But it’s possible to use it’s component functions directly. This is useful if, say, you’re writing move-concurently.

copy.file(from, to, options) → Promise

Copies an ordinary file from to destination to. Uses fs-write-stream-atomic to ensure that the file is either entirely copied or not at all.

Options are:

copy.symlink(from, to, options) → Promise

Copies a symlink from to destination to. If you’re using Windows and symlinking fails and what you’re linking is a directory then junctions will be tried instead.

Options are:

copy.recurse(from, to, options) → Promise

Reads all of the files in directory from and adds them to the queue using recurseWith (by default copy.item).

Options are:

copy.item(from, to, options) → Promise

Copies some kind of from to destination to. This looks at the filetype and calls copy.file, copy.symlink or copy.recurse as appropriate.

Symlink copies are queued with a priority such that they happen after all file and directory copies as you can’t create a junction on windows to a file that doesn’t exist yet.

Options are: