← All procedures
fs.write.json
Write a value as a JSON file, with a rename at the end
CLI- Package
- @procedures/fs · README
- Path
["fs","write","json"]- CLI
mark fs write json --path <string> --value <any>- As data
{"$proc":["fs","write","json"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/fs/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["fs","write","json"], { path: "<path>", value: "<value>" });
console.log(JSON.stringify(result));From the command line
$ mark fs write json --path <string> --value <any>
As data, in a program
{
"$proc": ["fs", "write", "json"],
"input": { "path": "<path>", "value": "<value>" }
}Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The path of the file"
},
"value": {
"description": "The value to write as JSON"
},
"indent": {
"description": "The spaces of the indent (default 2)",
"type": "integer",
"minimum": 0,
"maximum": 10
}
},
"required": [
"path",
"value"
]
},
"output": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The path of the file"
},
"bytesWritten": {
"type": "number",
"description": "The bytes of the file"
}
},
"required": [
"path",
"bytesWritten"
],
"additionalProperties": {}
}
}