https://github.com/thevickypedia/api-file-handler
Upload and download files using Spring based API
https://github.com/thevickypedia/api-file-handler
api-rest file-sharing filesystem java-8 springboot
Last synced: about 2 months ago
JSON representation
Upload and download files using Spring based API
- Host: GitHub
- URL: https://github.com/thevickypedia/api-file-handler
- Owner: thevickypedia
- License: mit
- Created: 2023-10-14T22:34:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-14T02:22:32.000Z (over 1 year ago)
- Last Synced: 2025-02-12T22:22:50.295Z (4 months ago)
- Topics: api-rest, file-sharing, filesystem, java-8, springboot
- Language: Java
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://spring.io/)


# API File Handler
Upload and download files using Spring based API## Env Variables
- **MAX_SIZE** - Maximum file size to be allowed.
- **UPLOADS** - Directory name to upload files into. _Creates a new one if not present already_
- **SOURCE** - Directory to download files from. _Creates a new one if not present already_
- **TOKEN** - Authentication token. _Required argument with `8` to `120` character limit_
- **PORT** - Port number to host the API. _Defaults to `8080`_
> Environment variables can be loaded from a `.env` file.## Usage
### Health Status
```shell
curl --location 'http://localhost:8080/health' \
--header 'Authorization: MyToken@2023'
```### Upload File
**Fail on existing file**
```shell
curl --location 'http://localhost:8080/upload-file' \
--header 'Authorization: MyToken@2023' \
--form 'file=@"~/sample.txt"'
```
**Overwrite existing file**
```shell
curl --location 'http://localhost:8080/upload-file?overwrite=true' \
--header 'Authorization: MyToken@2023' \
--form 'file=@"~/sample.txt"'
```### Download File
```shell
curl --location 'http://localhost:8080/download-file?fileName=sample.docx' \
--header 'Authorization: MyToken@2023'
```### List Files
```shell
curl --location 'http://localhost:8080/list-files' \
--header 'Authorization: MyToken@2023'
```## License & copyright
© Vignesh RaoLicensed under the [MIT License](https://github.com/thevickypedia/api-file-handler/blob/main/LICENSE)