Giter VIP home page Giter VIP logo

http-file-server's Introduction

http-file-server

http-file-server is a dependency-free HTTP file server. Beyond directory listings and file downloads, it lets you download a whole directory as as .zip or .tar.gz (generated on-the-fly).

screenshot

Contents

Examples

Serving a path at /

$ http-file-server /tmp
2018/11/13 23:00:03 serving local path "/tmp" on "/tmp/"
2018/11/13 23:00:03 redirecting to "/tmp/" from "/"
2018/11/13 23:00:03 http-file-server listening on ":8080"

Serving $PWD at /

$ cd /tmp
$ http-file-server
2018/12/13 03:18:00 serving local path "/tmp" on "/tmp/"
2018/12/13 03:18:00 redirecting to "/tmp/" from "/"
2018/12/13 03:18:00 http-file-server listening on ":8080"

Serving multiple paths, setting the HTTP port via CLI arguments

$ http-file-server -p 1234 /1=/tmp /2=/var/tmp
2018/11/13 23:01:44 serving local path "/tmp" on "/1/"
2018/11/13 23:01:44 serving local path "/var/tmp" on "/2/"
2018/11/13 23:01:44 redirecting to "/1/" from "/"
2018/11/13 23:01:44 http-file-server listening on ":1234"

Setting the HTTP port via environment variables

$ export PORT=9999
$ http-file-server /abc/def/ghi=/tmp
2018/11/13 23:05:52 serving local path "/tmp" on "/abc/def/ghi/"
2018/11/13 23:05:52 redirecting to "/abc/def/ghi/" from "/"
2018/11/13 23:05:52 http-file-server listening on ":9999"

Uploading files using cURL

$ ./http-file-server -uploads /=/path/to/serve
2020/03/10 22:00:54 serving local path "/path/to/serve" on "/"
2020/03/10 22:00:54 http-file-server listening on ":8080"
curl -LF "[email protected]" localhost:8080/path/to/upload/to

HTTPS (SSL/TLS)

To terminate SSL at the file server, set -ssl-cert (SSL_CERTIFICATE) and -ssl-key (SSL_KEY) to the respective files' paths:

$ ./http-file-server -port 8443 -ssl-cert server.crt -ssl-key server.key
2020/03/10 22:00:54 http-file-server (HTTPS) listening on ":8443"

Get it

Using go get

go get -u github.com/sgreben/http-file-server

Pre-built binary

Or download a binary from the releases page, or from the shell:

# Linux
curl -L https://github.com/sgreben/http-file-server/releases/download/1.6.1/http-file-server_1.6.1_linux_x86_64.tar.gz | tar xz

# OS X
curl -L https://github.com/sgreben/http-file-server/releases/download/1.6.1/http-file-server_1.6.1_osx_x86_64.tar.gz | tar xz

# Windows
curl -LO https://github.com/sgreben/http-file-server/releases/download/1.6.1/http-file-server_1.6.1_windows_x86_64.zip
unzip http-file-server_1.6.1_windows_x86_64.zip

Use it

http-file-server [OPTIONS] [[ROUTE=]PATH] [[ROUTE=]PATH...]
Usage of http-file-server:
  -a string
    	(alias for -addr) (default ":8080")
  -addr string
    	address to listen on (environment variable "ADDR") (default ":8080")
  -p int
    	(alias for -port)
  -port int
    	port to listen on (overrides -addr port) (environment variable "PORT")
  -q	(alias for -quiet)
  -quiet
    	disable all log output (environment variable "QUIET")
  -r value
    	(alias for -route)
  -route value
    	a route definition ROUTE=PATH (ROUTE defaults to basename of PATH if omitted)
  -ssl-cert string
    	path to SSL server certificate (environment variable "SSL_CERTIFICATE")
  -ssl-key string
    	path to SSL private key (environment variable "SSL_KEY")
  -u	(alias for -uploads)
  -uploads
    	allow uploads (environment variable "UPLOADS")

http-file-server's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

http-file-server's Issues

Add example for uploading files using curl

Because this was not as straightforward as I thought it was, I think it would be good to add this to the README.

How to upload files using curl:

./http-file-server -uploads /=/path/to/serve
curl -F "[email protected]" localhost:8080/path/to/upload/to

Alternatively, you could support the --upload-file function of curl, which does a PUT request to the new path for the file.

Add transmision speed and progress

http-file-server is very usfull for me, and it give me much help of my test.

Could you add transmission speed and progress to the server log, then we can see the translation quality of client.

Thank u.

[Feature request] Add ".." (go one direcory up) in directory listing

I was looking for something like http-file-server for a while and couldn't find a perfect solution. There are many tools like this and all of them miss some important features (like downloading a folder as zip).

http-file-server is almost perfect, but could you add ".." in directory listing to go to parent directory?

SSL/TLS support

Hello,

thanks for the great tool! Maybe you can mention that SSL/TLS is possible through stunnel.

Regards

start server: listen tcp :443: bind: permission denied

I love this speedy file server! But when I start the server, I cannot use ports 80 and 443 (because they are restricted, I believe), so I have to start as root. Is there a workaround? I have apache, the webserver, installed on my server running Arch Linux ARM, so a user http was created. But starting the server from that user still can't bind to those ports.

Passing a path where I want to my file to uploaded in

Hello,

I am using Postman to test this file server and I have 2 questions.

  1. I have created a sub-directory under the base path where I configured the file server to upload all files in. Is there a possibility in the upload API to pass this sub-directory path so my file will uploaded on it ?

  2. Can I pass a sub directory path in the GET API to return all files uploaded to the sub-directory ?

Thanks,
Saleh

Foss License?

Is there a FOSS license that this software is available under?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.