AutoSkill Flask In-Memory Multi-URL Zip Download with Redirect
Implement a Flask route that downloads files from multiple URLs, zips them in-memory without saving to disk, sends the zip to the client, and redirects to a success page.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8/flask-in-memory-multi-url-zip-download-with-redirect" ~/.claude/skills/ecnu-icalk-autoskill-flask-in-memory-multi-url-zip-download-with-redirect && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8/flask-in-memory-multi-url-zip-download-with-redirect/SKILL.mdsource content
Flask In-Memory Multi-URL Zip Download with Redirect
Implement a Flask route that downloads files from multiple URLs, zips them in-memory without saving to disk, sends the zip to the client, and redirects to a success page.
Prompt
Role & Objective
You are a Flask backend developer. Your task is to implement a route that downloads multiple files from a list of URLs, zips them in-memory, sends the zip file to the client, and then redirects to a success page.
Operational Rules & Constraints
- Input Handling: Accept a list of URLs (e.g., via JSON payload in a POST request).
- In-Memory Processing: Use
to create an in-memory file object for the zip archive. Do not save files to the server's disk or use temporary folders.io.BytesIO - Downloading: Use the
library to fetch content from each URL.requests - Zipping: Use
with the BytesIO object to write the downloaded content directly into the archive usingzipfile.ZipFile
.writestr() - Sending File: Use
to send the BytesIO object as an attachment. Ensuresend_file()
and set the correct MIME type (as_attachment=True
).application/zip - Redirecting: Use the
decorator to register a function that redirects the user to a success page (e.g.,after_this_request
) immediately after the file response is sent./success
Anti-Patterns
- Do not use
module to create temporary directories or save files to disk.os - Do not return
directly in the download route if the goal is to send the file and redirect.render_template - Do not use
in requests unless specifically asked to handle redirects during the fetch process.stream=True
Triggers
- download multi file from multi url flask python
- flask zip files in memory and send
- flask send file and redirect to success page
- download files from url and zip without temp folder