← All procedures

sqlite.backup

Copy a database to a new file (it does not replace a file)

CLI
Package
@procedures/sqlite · README
Path
["sqlite","backup"]
CLI
mark sqlite backup --to <string>
As data
{"$proc":["sqlite","backup"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/sqlite/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["sqlite","backup"], { to: "<to>" });
console.log(JSON.stringify(result));

From the command line

$ mark sqlite backup --to <string>

As data, in a program

{ "$proc": ["sqlite", "backup"], "input": { "to": "<to>" } }

Input

FieldTypeRequiredDefaultDescription
tostringyesThe new file. The procedure does not replace a file.
vacuumbooleannoDeprecated, with no effect: the copy is always compact. A later minor version removes it.
dbPathstringnoThe SQLite database file (default: the CLI log database, ~/logs/cli/cli.db)

Output

FieldTypeRequiredDefaultDescription
pathstringyesThe path of the copy
bytesnumberyesThe size of the copy, in bytes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "to": {
        "type": "string",
        "minLength": 1,
        "description": "The new file. The procedure does not replace a file."
      },
      "vacuum": {
        "description": "Deprecated, with no effect: the copy is always compact. A later minor version removes it.",
        "type": "boolean"
      },
      "dbPath": {
        "description": "The SQLite database file (default: the CLI log database, ~/logs/cli/cli.db)",
        "type": "string",
        "minLength": 1
      }
    },
    "required": [
      "to"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "description": "The path of the copy"
      },
      "bytes": {
        "type": "number",
        "description": "The size of the copy, in bytes"
      }
    },
    "required": [
      "path",
      "bytes"
    ],
    "additionalProperties": {}
  }
}