The fileserver
can be used as a static file server to share your file and also can as a private file server to upload and download your private files.
- Directory index
- File download
- File upload
- HTTPS supported
- Web UI
- JSON API
File upload - Using default file name
Following command will upload the img.png
to the directory /image/a/b/c/
on the file server and produces a file named img.png
.
$ curl -T img.png http://localhost:8880/image/a/b/c/
$ # or
$ curl -F 'file=@img.png' http://localhost:8880/image/a/b/c/
File upload - Specify file name
Following command will upload the img.png
to the directory /image/a/b/c/
on the file server and produces a file named another.png
.
$ curl -T img.png http://localhost:8880/image/a/b/c/another.png
$ # or
$ curl -F 'file=@img.png' http://localhost:8880/image/a/b/c/another.png
Note:
- If the specified directory does not exist on the file server, this directory will be created first.
- If the file to be uploaded already exists on the file server, the file will be overwritten.
File download
$ curl http://localhost:8880/image/a/b/c/another.png
Directory index
The directory index access URL is the same as the API's access URL(Such as http://localhost:8880/image/a/b/c/
). Just type the URL in the browser, and you'll see what's inside.
File upload
$ make build
It will be output a binary in the tmp
directory named with fileserver
$ make dev
It will run a air server to watch code change and reload the server.