# `Condukt.Sandbox.Transfer`
[🔗](https://github.com/tuist/tuist/blob/condukt@3.0.0/condukt/lib/condukt/sandbox/transfer.ex#L1)

Moves directories in and out of a sandbox as tar archives, a chunk at a
time, so an `.xcresult` bundle or a built `.app` never sits in memory
whole.

Both directions run `tar` in the sandbox as a process
(`c:Condukt.Sandbox.start_process/4`), base64-encoded so the bytes survive
sandboxes whose output is text, such as a remote exec. `export/3` follows
the process's log; `import_archive/4` writes the archive to its stdin, so
it needs `c:Condukt.Sandbox.write_process/4` too. The sandbox needs `tar`
and `base64`.

    sandbox
    |> Condukt.Sandbox.export("build/App.app")
    |> Stream.into(File.stream!("App.app.tar"))
    |> Stream.run()

    Condukt.Sandbox.import_archive(mac, "work/repo", Condukt.Sandbox.export(linux, "repo"))

# `export`

A stream of the tar archive of `path`, relative to the sandbox's working
directory. Enumerating it raises when the sandbox cannot run processes or
`tar` fails.

Options: `:timeout` in milliseconds (default one hour), and `:exclude`, a
list of `tar --exclude` patterns.

# `import_archive`

Unpacks `chunks`, an enumerable of a tar archive's bytes such as `export/3`
returns, into the directory `path`, creating it. Returns `:ok` or
`{:error, reason}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
