New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

copy-files-rev

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-files-rev

Copy files from source into destination

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

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 path

    • Value <Object> Folder data

      • foldersAndFiles <Array> Of <String> should contain the folders/files names you want to copy from the Key path

      • destination <String> Destination folder path

      • options <Object> This field is optional

        • allFiles <boolean> Default false, use true in case you want to copy all the files in the Key path

        • allDirectories <boolean> Default false, use true in case you want to copy all the folders in the Key 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.

More Examples

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

copy-files-tree

FAQs

Package last updated on 24 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts