Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When return a big file by FileResponse, How to realize resuming transfer on the server side #1896

Closed
9 tasks done
jl7599 opened this issue Aug 15, 2020 · 3 comments
Closed
9 tasks done

Comments

@jl7599
Copy link

jl7599 commented Aug 15, 2020

First check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google "How to X in FastAPI" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.
  • After submitting this, I commit to one of:
    • Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
    • I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.
    • Implement a Pull Request for a confirmed bug.

Example

Here's a self-contained, minimal, reproducible, example with my use case:

from fastapi import FastAPI
from fastapi.response import FileResponse

app = FastAPI()


@app.get("/download")
def downlaod_file():
    file_path = "/tmp/large.tar.gz"
    return FileResponse(file_path)

Description

  • wget -c http://127.0.0.1/download, and then Crtl + c abort this download, how to download from the existing file again
  • like flask.send_file conditional param
  • I know FileResponse support custom headers, and how to handle this custom headers

Environment

  • OS: Ubuntu 18.04
  • python version: 3.7.4
  • FastAPI Version : 0.61.0
@jl7599 jl7599 added the question Question or problem label Aug 15, 2020
@phy25
Copy link

phy25 commented Aug 15, 2020

See encode/starlette#950

@tiangolo
Copy link
Owner

tiangolo commented Dec 9, 2020

Thanks for the help @phy25 ! 🙇

Yep, that would be a request in Starlette, not in FastAPI. 🤓

@github-actions
Copy link
Contributor

Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs.

@tiangolo tiangolo reopened this Feb 28, 2023
Repository owner locked and limited conversation to collaborators Feb 28, 2023
@tiangolo tiangolo converted this issue into discussion #7238 Feb 28, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

3 participants