← All procedures

fs.glob

Find files matching glob pattern

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

From the command line

$ mark fs glob --pattern <string>

As data, in a program

{ "$proc": ["fs", "glob"], "input": { "pattern": "<pattern>" } }

Input

FieldTypeRequiredDefaultDescription
patternstringyesGlob pattern to match
cwdstringnoWorking directory (default: process.cwd())
absolutebooleannofalseReturn absolute paths (default: false)
dotbooleannofalseInclude dotfiles (default: false)
ignorestring[]noGlob patterns of the paths to leave out. The search does not enter the folders that they match.

Output

FieldTypeRequiredDefaultDescription
patternstringyesThe glob pattern
matchesstring[]yesThe matching paths, sorted: relative to cwd with "/" separators, or absolute with absolute: true
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "pattern": {
        "type": "string",
        "description": "Glob pattern to match"
      },
      "cwd": {
        "description": "Working directory (default: process.cwd())",
        "type": "string"
      },
      "absolute": {
        "default": false,
        "description": "Return absolute paths (default: false)",
        "type": "boolean"
      },
      "dot": {
        "default": false,
        "description": "Include dotfiles (default: false)",
        "type": "boolean"
      },
      "ignore": {
        "description": "Glob patterns of the paths to leave out. The search does not enter the folders that they match.",
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "pattern"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "pattern": {
        "type": "string",
        "description": "The glob pattern"
      },
      "matches": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "The matching paths, sorted: relative to cwd with \"/\" separators, or absolute with absolute: true"
      }
    },
    "required": [
      "pattern",
      "matches"
    ],
    "additionalProperties": {}
  }
}