Zebflow Docs
fs.file.delete
Zebflow Docs

fs.file.delete

Deletes a file and forgets its exposure rule

fs.file.delete --from FILE [--recursive] [--store TEXT] → file

Deletes a file and forgets its exposure rule. Delete the file --from names — a FileRef from the store it names, or a store key — and forget its exposure rule, so a later file at that key starts private. A store key naming a folder that holds files is refused (FW_NODE_FS_FILE_DELETE_FOLDER) unless --recursive is set, which removes the folder and everything under it — no confirmation, no trash. A FileRef is always one file. A file that is already gone succeeds. Adds file: { ref, deleted: true } (recursive: true beside them when a folder went) and keeps the rest of the payload.

Flags

  • --from (required): The file to delete: a FileRef or a store key.
  • --recursive: Let a store key naming a folder remove the folder and everything under it.
  • --store: The store a bare key is read from: local, or the id of an s3 credential; a FileRef is read from its own store. Saved explicitly when the pipeline is registered.

Examples

Delete an upload once it is processed

| fs.file.delete --from "{{ input.file }}"

Input:

json
{  "file": {    "__zf_type": "file_ref",    "backend": "zebfs",    "store": "local",    "ref": "uploads/a1.jpg",    "filename": "a1.jpg",    "mime": "image/jpeg",    "kind": "image",    "size": 1723,    "sha256": "sha256:…",    "lifecycle": "durable",    "origin": "fs.file.put",    "trust": "generated"  }}

It answers:

json
{  "file": {    "ref": "uploads/a1.jpg",    "deleted": true  }}