@wrote/clone
A package to clone a file or directory.
Last updated 6 years ago by zvr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @wrote/clone 
SYNC missed versions from official npm registry.

@wrote/clone

npm version

@wrote/clone is a package to clone a file or directory.

yarn add -E @wrote/clone

Table Of Contents

API

The package is available by importing its default function:

import clone from '@wrote/clone'

clone(
  path: string,
  to: string,
): void

Clones a file or directory to the specified directory. The to path should be the path of the folder which will contain the cloned entity and not the path to the new object on the filesystem.

/* yarn example/ */
import clone from '@wrote/clone'
import readDirStructure from '@wrote/read-dir-structure'

const printContent = async (path) => {
  const ds = await readDirStructure(path)
  console.log(JSON.stringify(ds, null, 2))
}

(async () => {
  // 0. CHECK what is being cloned.
  console.log('Directory being cloned:')
  await printContent('example/dir')

  // 1. CLONE the directory.
  await clone('example/dir', 'example/temp')

  // 1. VALIDATE that the directory was cloned.
  console.log('Temp directory contents:')
  await printContent('example/temp')
})()
Directory being cloned:
{
  "content": {
    "example.md": {
      "type": "File"
    }
  },
  "type": "Directory"
}
Temp directory contents:
{
  "content": {
    "dir": {
      "content": {
        "example.md": {
          "type": "File"
        }
      },
      "type": "Directory"
    }
  },
  "type": "Directory"
}

Copyright

Art Deco © Art Deco for Wrote 2019 Wrote Tech Nation Visa Tech Nation Visa Sucks

Current Tags

  • 1.2.1                                ...           latest (6 years ago)

6 Versions

  • 1.2.1                                ...           6 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.1                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 6
Last Day 0
Last Week 6
Last Month 0
Dependencies (3)
Dev Dependencies (7)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |