← All procedures

fs.stat

Get file or directory stats

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

From the command line

$ mark fs stat --path <string>

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
pathstringyesPath to get stats for

Output

FieldTypeRequiredDefaultDescription
pathstringyesThe path
type"file" | "directory" | "other"yesfile, directory or other
sizenumberyesThe size, in bytes
mtimestringyesThe time of the last change (ISO 8601)
ctimestringyesThe time of the last status change (ISO 8601)
atimestringyesThe time of the last access (ISO 8601)
modenumberyesThe mode bits (type and permissions)
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "Path to get stats for"
      }
    },
    "required": [
      "path"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "The path"
      },
      "type": {
        "type": "string",
        "enum": [
          "file",
          "directory",
          "other"
        ],
        "description": "file, directory or other"
      },
      "size": {
        "type": "number",
        "description": "The size, in bytes"
      },
      "mtime": {
        "type": "string",
        "description": "The time of the last change (ISO 8601)"
      },
      "ctime": {
        "type": "string",
        "description": "The time of the last status change (ISO 8601)"
      },
      "atime": {
        "type": "string",
        "description": "The time of the last access (ISO 8601)"
      },
      "mode": {
        "type": "number",
        "description": "The mode bits (type and permissions)"
      }
    },
    "required": [
      "path",
      "type",
      "size",
      "mtime",
      "ctime",
      "atime",
      "mode"
    ],
    "additionalProperties": {}
  }
}