Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Treatment tar

fs/archive::tar


Inputs

⇥ filesystem: Block<FileSystem> (fs/filesystem::FileSystem)
⇥ path: Block<string>

Outputs

↦ completed: Block<void>
↦ data: Stream<byte>
↦ errors: Stream<string>
↦ failed: Block<void>
↦ finished: Block<void>


Archive a directory.

The directory path of filesystem is archived as tar, given through data while its files are read, one at a time: nothing is written elsewhere, and memory does not grow with the directory.

Files, directories and links are archived, links as links, never followed, and paths are relative to path. Entries are sorted by name, with their mode and modification time (to the second), owned by 0 without user or group names: the same files give the same bytes. Other entries (devices, sockets, pipes) are left out, each named in errors.

Once the archive is complete, completed is emitted. If path is not a directory, or an entry cannot be read or changes while archived, failed is emitted and errors contains the reason: the data given before is not a complete archive. finished is emitted in every case.

graph LR
     T("tar()")
     F["〈🟨〉"] -->|filesystem| T
     P["〈🟨〉"] -->|path| T

     T -->|data| O["… 🟦 🟦 🟦"]
     T -->|completed| C["〈🟩〉"]

     style F fill:#ffffff,stroke:#ffffff
     style P fill:#ffffff,stroke:#ffffff
     style O fill:#ffffff,stroke:#ffffff
     style C fill:#ffffff,stroke:#ffffff