Skip to main content

Module files

Module files 

Source
Expand description

File and tar transfer. Four routes, opaque bodies, one query type.

There are no request or response bodies to model here — a file’s contents and an uncompressed tar are byte streams — so protocol::fs::FsQuery is the entire typed surface, and its failures answer text/plain rather than the JSON error body.

Two things the daemon’s contract makes non-obvious, both of which this module has to preserve rather than improve on:

  • mode is octal as a string. "644" and "0644" mean the same mode, and an integer would be read as decimal 644 by anything that stringifies it.
  • A missing path key is 400, and a directory where a file was asked for is 400. Only a genuinely absent path is 404. That distinction is why [file_exists] can be written at all: it keys on 404 and lets every other refusal through, so a typo in the query does not read as a missing artifact.