https://github.com/iamnator/imagecache
An Ephemeral server with a CLI tool for storing images (jpg, gif, png).
https://github.com/iamnator/imagecache
file-upload filesharing golang grpc
Last synced: 3 months ago
JSON representation
An Ephemeral server with a CLI tool for storing images (jpg, gif, png).
- Host: GitHub
- URL: https://github.com/iamnator/imagecache
- Owner: IamNator
- Created: 2022-06-17T06:34:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-20T13:03:24.000Z (over 3 years ago)
- Last Synced: 2025-01-29T22:46:49.383Z (8 months ago)
- Topics: file-upload, filesharing, golang, grpc
- Language: Go
- Homepage:
- Size: 27.5 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# imageCache
![]()
## REFERENCES
###### https://docs.buf.build
###### A modification of the code from https://github.com/rickslick/grpcUpload```markdown
imageCache can be used a CLI tool and a Server.
The CLI tool uploads files concurrently using grpc to a server instance of the application.If the server is spurned in a container
It is Ephemeral, meaning, all data is erased once the container shuts down.
To prevent this, you can make use of volumes.
```###### by default: all uploaded images are stored in /app/data/files
---
###### Featues :
* concurrent multi file upload using grpc with concept of chunking
* supports tls (both client and sever )
* Displays progress for each file
* Exposes endpoints for file downloads
* Exposes endpoint that return list of files of uploaded
---
###### How it works
![]()
Server Exposes GRPC and REST apis
CLI communicates with the grpc server from a terminal
---
## Quick Start
#### 1. spin off server
```shell
go run cmd/server/main.go
```
[more ...](./cmd/server/README.md)#### 2. upload a file
```shell
go run cmd/client/main.go upload 127.0.0.1:4000 -f ./testdata/sample23.png
```
[more ...](./cmd/cli/README.md)---

---### Working with Container (e.g Docker)
#### 1. Build Docker container
```shell
docker build . -t imageCachee.g docker build . -t imageCache
```
output:
```shell
mac@macs-MBP imageCache % docker build . -t imageCache
[+] Building 116.0s (8/11)
=> [internal] load build context 2.0s
=> => transferring context: 51.91kB 1.6s
=> [builder 1/4] FROM docker.io/library/golang:1.18-alpine@sha256
...
```
#### 2. Run Container (locally)
```shell
docker run --env-file .env -p 9900: -p 7700:e.g docker run --env-file .env -p 9900:9900 -p 7700:7700 server
```output:
```shell
mac@macs-MBP imageCache % docker run --env-file .env -p 9900:9900 -p 7700:7700 server
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)[GIN-debug] GET /data/files/:fileName --> imageCache/delivery/server.DownloadFileHandler (3 handlers)
[GIN-debug] GET /list --> imageCache/delivery/server.ListFilesHandler (3 handlers)
======> we are running REST APIs @ :9900
=========> We are running GRPC APIs @ 127.0.0.1:7700```