Skip to content

Instantly share code, notes, and snippets.

View HeinrichWizardKreuser's full-sized avatar

Heinrich HeinrichWizardKreuser

  • Amazon Web Services
  • Century City, Cape Town, South Africa
View GitHub Profile
@HeinrichWizardKreuser
HeinrichWizardKreuser / fileresponseutils.py
Created August 2, 2021 09:51
Django FIleResponse helpers
from django.http import FileResponse
from io import BufferedReader, BytesIO
def file_response_from_str(content: str, filename: str) -> FileResponse:
""" Serves a file response from the given string
Args:
content: str