← 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
| Field | Type | Required | Default | Description |
|---|
path | string | yes | | Path to get stats for |
Output
| Field | Type | Required | Default | Description |
|---|
path | string | yes | | The path |
type | "file" | "directory" | "other" | yes | | file, directory or other |
size | number | yes | | The size, in bytes |
mtime | string | yes | | The time of the last change (ISO 8601) |
ctime | string | yes | | The time of the last status change (ISO 8601) |
atime | string | yes | | The time of the last access (ISO 8601) |
mode | number | yes | | The 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": {}
}
}