Transmit files by using only common Unix/Linux commands, curl
or wget
branch | TravisCI | CircleCI | Coverage |
---|---|---|---|
master |
|||
develop |
https://trans-akka.herokuapp.com/
You can send, download and delete a file by the following commands.
# Send a file
wget -q -O - https://trans-akka.herokuapp.com/ --post-file=./test.txt
# Downlaod the file
wget https://trans-akka.herokuapp.com/a7h
# ('a7h' is a File ID created after sending)
# Delete a file
wget -q -O - --method DELETE https://trans-akka.herokuapp.com/a7h
-q
: No prgress bar-O -
: Response to stdout
- Send/Get by only common commands,
curl
orwget
- Send/Get on your browser
- Send/Get with restrictions
- download key
- store duration
- how many times you can download
- Delete files you sent
- without delete key
- with delete key
- Change File ID length (for security)
- Encrypt and Compress file for security
You can choose any ways you want bellow.
docker run -p 8080:8181 nwtgck/trans-server-akka
Then you can go http://localhost:8080/
You can also run the following command for daemonize and data persistence.
docker run -d -p 8080:8181 -v $PWD/trans-db:/trans/db --restart=always nwtgck/trans-server-akka
Data will be stored in $PWD/trans-db
on your host machine. (Currently file-base H2 database is used, and files sent are stored as compressed and encrypted files)
The following example runs a server on 80 port.
$ cd <this-project>
$ ./make-keystore.sh
$ sbt "run-main io.github.nwtgck.trans_server.Main --http-port=8282"
$ cd <this-project>
$ ./make-keystore.sh
$ cd <this-project>
$ sbt assembly
(It takes a time)
$ java -jar target/scala-2.11/trans-server-akka.jar --http-port=8282 --https-port=4433
The following example is sending ../test.txt
$ curl https://trans-akka.herokuapp.com/ --data-binary @../test.txt
ab2
The server response, ab2
is a File ID to get ../test.txt
The following example sends ../test.txt
$ wget -q -O - https://trans-akka.herokuapp.com/ --post-file=../test.txt
-q
is for non-progress bar-O -
is to output STDOUT
9vi
The server response, 9vi
is a File ID to get ../test.txt
This way is for a user which can't use curl
command.
The following example sends sounds.zip
.
$ wc -c < sounds.zip
1161257298 # Use it later
POST / HTTP/1.1
Host: localhost:4343
Content-Length: 1161257298
Don't forget the end of '\n'
$ cat header.txt sounds.zip | nc localhost 4343
The response is bellow.
HTTP/1.1 200 OK
Server: akka-http/10.0.5
Date: Sun, 23 Apr 2017 04:22:32 GMT
Connection: close
Content-Type: text/plain; charset=UTF-8
Content-Length: 4
6oz
6oz
is FILE ID.
$ wget https://trans-akka.herokuapp.com/ab2
ab2
is a File ID.
$ curl https://trans-akka.herokuapp.com/ab2 > test.txt
ab2
is a File ID.
Open https://trans-akka.herokuapp.com/ab2
on your browser
ab2
is a File ID.
Here is options you can use when sending
GET parameter | default value | decription |
---|---|---|
duration |
1 hour | Store duration/life |
get-times |
infinite | How many times you can download |
id-length |
3 |
Length of File ID |
deletable |
true |
Whether a file can be deleted |
delete-key |
nothing | Key for deletion |
secure-char |
false |
Whether more complex characters are used for File ID |
wget -q -O - 'https://trans-akka.herokuapp.com/?duration=30s&get-times=1&id-length=16&delete-key=mykey1234&secure-char' --post-file=./hello.txt
The command means
- duration is 30 seconds
- download once
- File ID length is 16
- The file is deletable and key is
'mykey1234'
- Use more complex characters for File ID
10s
- 10 seconds2m
- 2 minutes12h
- 12 hours25d
- 25 days
All bellow are valid usages.
'https://trans-akka.herokuapp.com/?deletable'
# (same meaning as `deletable=true`)
'https://trans-akka.herokuapp.com/?deletable=true'
'https://trans-akka.herokuapp.com/?deletable=false'
curl -u dummy_user:mypass123 -T ./hello.txt https://trans-akka.herokuapp.com
When you don't want to type key in command, you can use -u dummy_user
instead of -u dummy_user:mypass123
. Then, curl
provide you a password prompt.
NOTE: dummy_user
can be change any name including empty ''
.
curl -u dummy_user:mypass123 https://trans-akka.herokuapp.com/yk2
NOTE: The server doesn't check user name. So, you can use any name for user name, not only "dummy_user"
.
# wget version
wget -q -O - --method=DELETE 'https://trans-akka.herokuapp.com/vua'
# curl version
curl -X DELETE 'https://trans-akka.herokuapp.com/vua'
(vua
is a File ID)
# wget version
wget -q -O - --method=DELETE 'https://trans-akka.herokuapp.com/6em?delete-key=1234'
# curl version
curl -X DELETE 'https://trans-akka.herokuapp.com/6em?delete-key=1234'