Metadata-Version: 2.1
Name: fastapiFileManager
Version: 1.1.0
Summary: A plug-and-play file management package for FastAPI.
Home-page: https://github.com/emeraldlinks/file-manager
Author: Joseph Christopher
Author-email: Joseph Christopher <joechristophersc@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/emeralidlinks/file-manager
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Framework :: FastAPI
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: fastapi
Requires-Dist: uvicorn

# File Manager for FastAPI

A plug-and-play solution for managing file uploads in FastAPI apps. It handles file uploads, saves them uniquely, and serves them via a static route automatically.

## Installation

Install using pip:

```bash
pip install fastapiFileManager


#File manager for fastApi is designed to be a plug and play package to manage files in fastapi just like in django. you only need three line of code:

from fastapiFileManager import FileManager
file_manager = FileManager(app=app, base_path="uploads", route_path="/
files")

    file_url = file_manager.save_file(file)


## full example:



from fastapi import FastAPI, UploadFile
from file_manager import FileManager

app = FastAPI()

# Initialize FileManager
file_manager = FileManager(app=app, base_path="uploads", route_path="/files")

 
@app.post("/upload")
async def upload_file(file: UploadFile):
    # Save the file and get its URL
    file_url = file_manager.save_file(file)
    return {"file_url": file_url, "check as": f"localhost:8000/{file_url}"}


@app.get("/download/{filename}")
async def download_file(filename: str):
    # Serve the file for download
    return file_manager.serve_file(filename)



# file-manager
