Skip to content

FSFS is a lightweight Flask-based file server, efficient and user-friendly solution for handling diverse file formats seamlessly.

License

Notifications You must be signed in to change notification settings

1999AZZAR/Flask-Simple-File-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Simple File Server (FSFS)

Table of Contents

Introduction

Flask Simple File Server (FSFS) is a robust and user(admin)-friendly data application developed with Flask. Its primary purpose is to facilitate seamless file management, offering features like file upload, download, and categorization. Built on top of Flask, FSFS ensures a lightweight and efficient solution for organizing and accessing files.

Features

  1. File Upload and Categorization: Users can effortlessly upload files through the intuitive web interface. FSFS automatically categorizes files based on their extensions, making it easy to organize and locate them.

  2. File Download:

    • standard: Downloading files is straightforward. Users can retrieve files by specifying the filename, and FSFS provides a direct download link for quick access.
    • enhanced: download endpoints for better user experience, supporting specific files, file formats, extensions, and bulk downloads.
  3. File Listing: FSFS maintains a detailed list of all uploaded files, including essential information such as filename, extension, category, and upload timestamp. This feature enhances visibility and allows users to review their uploaded content easily.

  4. File Categorization: Uploaded files are intelligently organized into distinct folders according to their file types. This systematic categorization includes folders for images, videos, audio files, documents, compressed files, XML-related files, and a miscellaneous folder for unrecognized file types.

  5. SQLite Database Integration: FSFS utilizes an SQLite database (files.db) to store and manage file metadata. The database ensures data persistence and enables efficient retrieval of file information.

  6. General Folder: FSFS now includes a "GENERAL_FOLDER" for files with extensions not covered by existing categories.

  7. Delete: delete specific file using the filename as the value for the delete endpoint make it easier to delete unwanted file.

Installation

Setting up FSFS is a straightforward process. Follow these steps:

  1. Clone the Repository:

    git clone https://github.com/1999AZZAR/Flask-Simple-File-Server.git
    cd Flask-Simple-File-Server
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Run the Application:

    cd code
    python the_server.py

    Access the server at http://localhost:2500 and here for more detailed instructions.

Usage

FSFS offers a user-friendly experience for managing files. Users can utilize the provided API endpoints to interact with the file server. Refer to the API Endpoints section for detailed information.

API Endpoints

1. Upload File

Endpoint: /upload
Method: POST
Parameters:

  • file: The file to be uploaded
  • example

2. Download File

Endpoint: /download
Method: GET
Parameters:

  • filename: The name of the file to be downloaded
  • fileformat: The file format for bulk download
  • extension: The file extension for bulk download
  • all: Download all files
  • usage example /download?fileformat=Image will download all image files.
  • code example

3. List Files

Endpoint: /list
Method: GET
Returns: JSON array containing details of all uploaded files

4. List Files with Specific File Format or Extension

  • To list files of a specific file format, use /list?fileformat=<your_file_format>
  • To list files with a specific extension, use /list?extension=<your_extension>

For example:

  • /list?fileformat=Image will list all image files.
  • /list?extension=.pdf will list all PDF files.

5. Delete File

Endpoint: /delete/<filename>
Method: DELETE
Parameters:

  • filename: The name of the file to be deleted

Usage example: /delete/myfile.txt will delete the file named "myfile.txt".

Database Structure

FSFS employs an SQLite database (files.db) with a table named files to store file information. The table structure is as follows:

  • filename: Name of the uploaded file
  • extension: File extension
  • category: File category (e.g., Image, Video)
  • upload_time: Timestamp of when the file was uploaded

File Categories

Files are intelligently categorized into the following folders based on their extensions:

  • other_files: Miscellaneous files
  • xml_files: XML-related files
  • img_files: Image files
  • video_files: Video files
  • audio_files: Audio files
  • document_files: Document files
  • compressed_files: Compressed files
  • null_files: Files with no recognizable extension
  • general_files: Files with unknown extensions

Flowchart

Flowchart

Contributing

Contributions to FSFS are highly encouraged. Whether it's bug fixes, feature enhancements, or feedback, your input is valuable. Feel free to open issues or submit pull requests.

License

FSFS is licensed under the MIT License. Your usage and contributions are subject to the terms specified in the license.

About

FSFS is a lightweight Flask-based file server, efficient and user-friendly solution for handling diverse file formats seamlessly.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages