Use a temporary file to produce downloadable pack.

- Reads from the static sample file into the temp file.
- Code cleanup & comments.