copy-files-rev
v1.0.3
Published
Copy files from source into destination
Downloads
8
Maintainers
Readme
copy-files-rev
Copy files and folders to a wanted destination.
This is the next generation of copy-files-tree package
Getting Started
To install package using npm
npm install --save copy-files-rev
Or with yarn
yarn add copy-files-rev
How to use?
Sync usage:
import {copyFilesSync} from 'copy-files-rev'
const error = copyFilesSync(FoldersData);
Async usage:
import {copyFiles} from 'copy-files-rev'
(async () => {
const error = await copyFiles(FoldersData);
})()
Props
FoldersData
<Object>
Key
<String>
Folder source pathValue
<Object>
Folder datafoldersAndFiles
<Array>
Of<String>
should contain the folders/files names you want to copy from theKey
pathdestination
<String>
Destination folder pathoptions
<Object>
This field is optionalallFiles
<boolean>
Defaultfalse
, use true in case you want to copy all the files in theKey
pathallDirectories
<boolean>
Defaultfalse
, use true in case you want to copy all the folders in theKey
path
Example:
import {copyFiles} from 'copy-files-rev'
const FoldersData = {
'/Users/user1/folder-name-1': {
foldersAndFiles: ['image.png', 'inner-folder-name1'],
destination: '/Users/user1/some-folder-name',
},
'/Users/user2/folder-name-2': {
options: {
allFiles: true, // Folder files [`file-name1.txt`, `file-name2.txt`]
},
destination: '/Users/user2/some-folder-name2'
}
}
(async () => {
const error = await copyFiles(FoldersData);
})()
Files Structure
/Users/ ----- |
- user1 --- folder-name-1 ---
| |
| - 'image.png'
| |
| - 'inner-folder-name1' // With all the inner files and folders
|
|
- user2 --- folder-name-2 ---
|
- `file-name1.txt`
|
- `file-name2.txt`
Donations
Please don't hesitate to donate this package, and reaching me out.
License
This project is licensed under the MIT License - see the LICENSE.md file for details