← All procedures

fs.copy

Copy file or directory

CLI
Package
@procedures/fs · README
Path
["fs","copy"]
CLI
mark fs copy --src <string> --dest <string>
As data
{"$proc":["fs","copy"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/fs"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["fs","copy"], { src: "<src>", dest: "<dest>" });
console.log(JSON.stringify(result));

From the command line

$ mark fs copy --src <string> --dest <string>

As data, in a program

{
  "$proc": ["fs", "copy"],
  "input": { "src": "<src>", "dest": "<dest>" }
}

Input

FieldTypeRequiredDefaultDescription
srcstringyesSource path
deststringyesDestination path
recursivebooleannotrueCopy directories recursively (default: true)
overwritebooleannofalseOverwrite existing files (default: false)

Output

FieldTypeRequiredDefaultDescription
srcstringyesThe source path
deststringyesThe destination path
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "src": {
        "type": "string",
        "description": "Source path"
      },
      "dest": {
        "type": "string",
        "description": "Destination path"
      },
      "recursive": {
        "default": true,
        "description": "Copy directories recursively (default: true)",
        "type": "boolean"
      },
      "overwrite": {
        "default": false,
        "description": "Overwrite existing files (default: false)",
        "type": "boolean"
      }
    },
    "required": [
      "src",
      "dest"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "src": {
        "type": "string",
        "description": "The source path"
      },
      "dest": {
        "type": "string",
        "description": "The destination path"
      }
    },
    "required": [
      "src",
      "dest"
    ],
    "additionalProperties": {}
  }
}