Skip to content

Share files locally using http

Johan Nylander edited this page Jun 17, 2024 · 4 revisions

Linux

  • Last modified: June 17 2024
  • Sign: JN
  • Tested on: Xubuntu 22.04
  • Solved: Yes

Share a file on local network using http

One way of sharing files is to expose them for download using http. The application woof allows you to create a temporary download link to a file by starting a temporary webserver that allows a one-time access to a file. After download (once, the default, or n times), then the webserver shuts down, and the link disappears.

Examples

Note 1 These examples will only work if computers are on the same local network (i.e., behind the firewall)

Note 2 If using a download client (e.g., wget), use the -O option to name the output. Otherwise you will get the default (index.html). It might also be good to inform the receiver which file (file/folder/.gz, etc) to expect.

Install woof (example on Ubuntu Linux)

[galaxy]$ git clone https://github.com/simon-budig/woof.git
[galaxy]$ cp woof/woof ~/bin
[galaxy]$ chmod +x ~/bin/woof

Share a one-time download link to a file

Here we start woof in a screen session, which allows us to detach the process easily. In case the receiver is slow in responding...

[computer 1]$ screen -S Woof.file
[computer 1]$ woof myfile
Now serving on http://123.45.67.89:8080/

[computer 2]$ wget -O my.woof "http://123.45.67.89:8080"
--2020-02-20 13:34:30--  http://123.45.67.89:8080/
Connecting to 123.45.67.89:8080... connected.
HTTP request sent, awaiting response... 302 Found
Location: /data.csv [following]
--2020-02-20 13:34:30--  http://123.45.67.89:8080/data.csv
Connecting to 123.45.67.89:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 529 [application/octet-stream]
Saving to: ‘my.woof’

my.woof                  100%[==================================>]     529  --.-KB/s    in 0s      

2020-02-20 13:34:31 (52,9 MB/s) - ‘my.woof’ saved [529/529]

Share a two-time download link to compressed directory

Note that woof will create the .gz file on download.

[computer 1]$ screen -S Woof.dir
[computer 1]$ woof -c 2 -z mydir

[computer 2]$ wget -O my.woof.gz "http://123.45.67.89:8080"
--2020-02-20 13:40:55--  http://123.45.67.89:8080/
Connecting to 123.45.67.89:8080... connected.
HTTP request sent, awaiting response... 302 Found
Location: /mydir.tar.gz [following]
--2020-02-20 13:40:55--  http://123.45.67.89:8080/mydir.tar.gz
Connecting to 123.45.67.89:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]
Saving to: ‘my.woof.gz’

my.woof.gz                   [ <=>                               ]     144  --.-KB/s    in 0s      

2020-02-20 13:40:56 (335 KB/s) - ‘my.woof.gz’ saved [144]

See also