Skip to content

Commit 3d9d101

Browse files
committed
revise README
1 parent e555e1e commit 3d9d101

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ $ ./simple_upload_server -token f9403fc5f537b4ab332d $HOME/tmp
1414

1515
## Uploading
1616

17+
You can upload files with `POST /upload`.
18+
The filename is taken from the original file if available. If not, SHA1 hex digest will be used as the filename.
19+
1720
```
1821
$ echo 'Hello, world!' > sample.txt
1922
$ curl [email protected] 'http://localhost:25478/upload?token=f9403fc5f537b4ab332d'
@@ -25,8 +28,20 @@ $ cat $HOME/tmp/sample.txt
2528
hello, world!
2629
```
2730

31+
**OR**
32+
33+
Use `PUT /files/(filename)`.
34+
In this case, the original file name is ignored, and the name is taken from the URL.
35+
36+
```
37+
$ curl -X PUT [email protected] "http://localhost:25478/files/another_sample.txt?token=f9403fc5f537b4ab332d"
38+
{"ok":true,"path":"/files/another_sample.txt"}
39+
```
40+
2841
## Downloading
2942

43+
`GET /files/(filename)`.
44+
3045
```
3146
$ curl 'http://localhost:25478/files/sample.txt?token=f9403fc5f537b4ab332d'
3247
hello, world!
@@ -49,3 +64,9 @@ INFO[0000] start listening ip=0.0.0.0 port=25478 r
4964
```
5065

5166
NOTE: The token is generated from the random number, so it will change every time you start the server.
67+
68+
# Docker
69+
70+
```
71+
$ docker run -p 25478:25478 -v $HOME/tmp:/var/root mayth/go-simple-upload-server app -token f9403fc5f537b4ab332d /var/root
72+
```

0 commit comments

Comments
 (0)