Create a web interface for using this file transfer API, it ...
Prompt
Create a web interface for using this file transfer API, it should be able to stream the file as a download instead of loading the entire thing into RAM, which can cause SIGTRAP with some larger files. API Spec: { "openapi": "3.1.0", "info": { "title": "Quick Transfer", "description": "Public file uploads and downloads. An optional password protects deletion only. Upload bodies are raw bytes, not multipart/form-data.", "version": "1.0.0" }, "paths": { "/files": { "post": { "summary": "Upload", "operationId": "upload_files_post", "parameters": [ { "name": "filename", "in": "query", "required": true, "schema": { "type": "string", "minLength": 1, "maxLength": 255, "pattern": "^[^/\\\\\\x00-\\x1f\\x7f]+$", "description": "Download filename, without directory components.", "title": "Filename" }, "description": "Download filename, without directory components." }, { "name": "X-Delete-Password", "in": "header", "required": false, "schema": { "anyOf": [ { "type": "string", "minLength": 1, "maxLength": 1024 }, { "type": "null" } ], "description": "Optional on upload; required to delete a protected file.", "title": "X-Delete-Password" }, "description": "Optional on upload; required to delete a protected file." } ], "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadResult" } } } }, "400": { "description": "Invalid or mismatched Content-Length" }, "413": { "description": "File exceeds the configured size limit" }, "415": { "description": "Use Content-Type: application/octet-stream" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "requestBody": { "required": true, "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } } } } } }, "/files/{file_id}": { "get": { "summary": "Download File", "operationId": "download_file_files__file_id__get", "parameters": [ { "name": "file_id", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[0-9a-f]{32}$", "title": "File Id" } }, { "name": "Range", "in": "header", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Example: bytes=0-1048575", "title": "Range" }, "description": "Example: bytes=0-1048575" } ], "responses": { "200": { "description": "Successful Response", "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } } } }, "206": { "description": "Partial content for a byte-range request" }, "400": { "description": "Malformed Range header" }, "404": { "description": "File not found" }, "416": { "description": "Requested range is not satisfiable" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "head": { "summary": "Head File", "operationId": "head_file_files__file_id__head", "parameters": [ { "name": "file_id", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[0-9a-f]{32}$", "title": "File Id" } }, { "name": "Range", "in": "header", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "Example: bytes=0-1048575", "title": "Range" }, "description": "Example: bytes=0-1048575" } ], "responses": { "200": { "description": "Successful Response" }, "404": { "description": "File not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "summary": "Delete", "operationId": "delete_files__file_id__delete", "parameters": [ { "name": "file_id", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[0-9a-f]{32}$", "title": "File Id" } }, { "name": "X-Delete-Password", "in": "header", "required": false, "schema": { "anyOf": [ { "type": "string", "minLength": 1, "maxLength": 1024 }, { "type": "null" } ], "description": "Optional on upload; required to delete a protected file.", "title": "X-Delete-Password" }, "description": "Optional on upload; required to delete a protected file." } ], "responses": { "204": { "description": "Successful Response" }, "403": { "description": "Missing or incorrect deletion password" }, "404": { "description": "File not found" }, "409": { "description": "File is being downloaded; retry later" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "UploadResult": { "properties": { "id": { "type": "string", "title": "Id" }, "filename": { "type": "string", "title": "Filename" }, "size_bytes": { "type": "integer", "title": "Size Bytes" }, "delete_protected": { "type": "boolean", "title": "Delete Protected" }, "download_url": { "type": "string", "title": "Download Url" } }, "type": "object", "required": [ "id", "filename", "size_bytes", "delete_protected", "download_url" ], "title": "UploadResult" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" }, "input": { "title": "Input" }, "ctx": { "type": "object", "title": "Context" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } } }
A system prompt was added to support web rendering
Response not available