Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wrote/clone

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wrote/clone

A package to clone a file or directory.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@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"
}

TODO

  • Clone symbolic links and other entities.

(c) Wrote 2018

Keywords

FAQs

Package last updated on 27 Sep 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc