← All procedures

fs.rm

Remove file or directory

CLI
Package
@procedures/fs · README
Path
["fs","rm"]
CLI
mark fs rm --path <string>
As data
{"$proc":["fs","rm"],"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","rm"], { path: "<path>" });
console.log(JSON.stringify(result));

From the command line

$ mark fs rm --path <string>

As data, in a program

{ "$proc": ["fs", "rm"], "input": { "path": "<path>" } }

Input

FieldTypeRequiredDefaultDescription
pathstringyesPath to remove
recursivebooleannofalseRemove directories and contents recursively (default: false)
forcebooleannofalseIgnore errors if path doesn't exist (default: false)

Output

FieldTypeRequiredDefaultDescription
pathstringyesThe path
removedbooleanyesFalse when the path did not exist (with force)
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "Path to remove"
      },
      "recursive": {
        "default": false,
        "description": "Remove directories and contents recursively (default: false)",
        "type": "boolean"
      },
      "force": {
        "default": false,
        "description": "Ignore errors if path doesn't exist (default: false)",
        "type": "boolean"
      }
    },
    "required": [
      "path"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "The path"
      },
      "removed": {
        "type": "boolean",
        "description": "False when the path did not exist (with force)"
      }
    },
    "required": [
      "path",
      "removed"
    ],
    "additionalProperties": {}
  }
}