https://github.com/a-khakimov/gridfs-scala-example
https://github.com/a-khakimov/gridfs-scala-example
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/a-khakimov/gridfs-scala-example
- Owner: a-khakimov
- Created: 2024-04-28T18:41:04.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-28T18:50:15.000Z (over 1 year ago)
- Last Synced: 2025-02-03T12:46:35.052Z (8 months ago)
- Language: Scala
- Size: 1.88 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GridFS example
For file uploading and downloading over http
Upload pic
```bash
➜ gridfs-example git:(master) ✗ curl -X POST -H "Content-Type: image/jpeg" --data-binary "@path/to/cat.jpg" http://localhost:8080/photoPhoto uploaded with id: 662e993bacca585fd977b32a%
```Show files in GridFS
```bash
➜ gridfs-example git:(master) ✗ mongofiles list
2024-04-28T23:45:57.381+0500 connected to: mongodb://localhost/
photo.jpg 2036202
```Download pic by id
```bash
➜ gridfs-example git:(master) ✗ curl -v -OJ http://localhost:8080/photo/662e993bacca585fd977b32a.jpeg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET /photo/662e993bacca585fd977b32a.jpeg HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sun, 28 Apr 2024 18:46:31 GMT
< Connection: keep-alive
< Content-Length: 2036202
< Content-Type: image/jpeg
<
{ [102269 bytes data]
```