You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 6.0 KiB

7 years ago
9 years ago
9 years ago
5 years ago
5 years ago
5 years ago
5 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
7 years ago
7 years ago
9 years ago
9 years ago
7 years ago
9 years ago
7 years ago
9 years ago
7 years ago
7 years ago
5 years ago
7 years ago
5 years ago
7 years ago
7 years ago
7 years ago
5 years ago
9 years ago
5 years ago
7 years ago
9 years ago
7 years ago
9 years ago
9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. # transfer.sh [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dutchcoders/transfer.sh?utm_source=badge&utm_medium=badge&utm_campaign=&utm_campaign=pr-badge&utm_content=badge) [![Go Report Card](https://goreportcard.com/badge/github.com/dutchcoders/transfer.sh)](https://goreportcard.com/report/github.com/dutchcoders/transfer.sh) [![Docker pulls](https://img.shields.io/docker/pulls/dutchcoders/transfer.sh.svg)](https://hub.docker.com/r/dutchcoders/transfer.sh/) [![Build Status](https://travis-ci.org/dutchcoders/transfer.sh.svg?branch=master)](https://travis-ci.org/dutchcoders/transfer.sh)
  2. Easy and fast file sharing from the command-line. This code contains the server with everything you need to create your own instance.
  3. Transfer.sh currently supports the s3 (Amazon S3), gdrive (Google Drive) providers, and local file system (local).
  4. ## Disclaimer
  5. This project repository has no relation with the service at https://transfer.sh that's managed by https://storj.io.
  6. So far we cannot address any issue related to the service at https://transfer.sh.
  7. ## Usage
  8. ### Upload:
  9. ```bash
  10. $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt
  11. ```
  12. ### Encrypt & upload:
  13. ```bash
  14. $ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/test.txt
  15. ````
  16. ### Download & decrypt:
  17. ```bash
  18. $ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt
  19. ```
  20. ### Upload to virustotal:
  21. ```bash
  22. $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal
  23. ```
  24. ## Add alias to .bashrc or .zshrc
  25. ### Using curl
  26. ```bash
  27. transfer() {
  28. curl --progress-bar --upload-file "$1" https://transfer.sh/$(basename $1) | tee /dev/null;
  29. }
  30. alias transfer=transfer
  31. ```
  32. ### Using wget
  33. ```bash
  34. transfer() {
  35. wget -t 1 -qO - --method=PUT --body-file="$1" --header="Content-Type: $(file -b --mime-type $1)" https://transfer.sh/$(basename $1);
  36. }
  37. alias transfer=transfer
  38. ```
  39. ## Add alias for fish-shell
  40. ### Using curl
  41. ```fish
  42. function transfer --description 'Upload a file to transfer.sh'
  43. if [ $argv[1] ]
  44. # write to output to tmpfile because of progress bar
  45. set -l tmpfile ( mktemp -t transferXXX )
  46. curl --progress-bar --upload-file "$argv[1]" https://transfer.sh/(basename $argv[1]) >> $tmpfile
  47. cat $tmpfile
  48. command rm -f $tmpfile
  49. else
  50. echo 'usage: transfer FILE_TO_TRANSFER'
  51. end
  52. end
  53. funcsave transfer
  54. ```
  55. ### Using wget
  56. ```fish
  57. function transfer --description 'Upload a file to transfer.sh'
  58. if [ $argv[1] ]
  59. wget -t 1 -qO - --method=PUT --body-file="$argv[1]" --header="Content-Type: (file -b --mime-type $argv[1])" https://transfer.sh/(basename $argv[1])
  60. else
  61. echo 'usage: transfer FILE_TO_TRANSFER'
  62. end
  63. end
  64. funcsave transfer
  65. ```
  66. Now run it like this:
  67. ```bash
  68. $ transfer test.txt
  69. ```
  70. ## Add alias on Windows
  71. Put a file called `transfer.cmd` somewhere in your PATH with this inside it:
  72. ```cmd
  73. @echo off
  74. setlocal
  75. :: use env vars to pass names to PS, to avoid escaping issues
  76. set FN=%~nx1
  77. set FULL=%1
  78. powershell -noprofile -command "$(Invoke-Webrequest -Method put -Infile $Env:FULL https://transfer.sh/$Env:FN).Content"
  79. ```
  80. ## Link aliases
  81. Create direct download link:
  82. https://transfer.sh/1lDau/test.txt --> https://transfer.sh/get/1lDau/test.txt
  83. Inline file:
  84. https://transfer.sh/1lDau/test.txt --> https://transfer.sh/inline/1lDau/test.txt
  85. ## Usage
  86. Parameter | Description | Value | Env
  87. --- | --- | --- | ---
  88. listener | port to use for http (:80) | |
  89. profile-listener | port to use for profiler (:6060)| |
  90. force-https | redirect to https | false |
  91. tls-listener | port to use for https (:443) | |
  92. tls-listener-only | flag to enable tls listener only | |
  93. tls-cert-file | path to tls certificate | |
  94. tls-private-key | path to tls private key | |
  95. http-auth-user | user for basic http auth on upload | |
  96. http-auth-pass | pass for basic http auth on upload | |
  97. ip-whitelist | comma separated list of ips allowed to connect to the service | |
  98. ip-blacklist | comma separated list of ips not allowed to connect to the service | |
  99. temp-path | path to temp folder | system temp |
  100. web-path | path to static web files (for development or custom front end) | |
  101. proxy-path | path prefix when service is run behind a proxy | |
  102. ga-key | google analytics key for the front end | |
  103. uservoice-key | user voice key for the front end | |
  104. provider | which storage provider to use | (s3, grdrive or local) |
  105. aws-access-key | aws access key | | AWS_ACCESS_KEY
  106. aws-secret-key | aws access key | | AWS_SECRET_KEY
  107. bucket | aws bucket | | BUCKET
  108. s3-no-multipart | disables s3 multipart upload | false | |
  109. basedir | path storage for local/gdrive provider| |
  110. gdrive-client-json-filepath | path to oauth client json config for gdrive provider| |
  111. gdrive-local-config-path | path to store local transfer.sh config cache for gdrive provider| |
  112. gdrive-chunk-size | chunk size for gdrive upload in megabytes, must be lower than available memory (8 MB) | |
  113. lets-encrypt-hosts | hosts to use for lets encrypt certificates (comma seperated) | |
  114. log | path to log file| |
  115. If you want to use TLS using lets encrypt certificates, set lets-encrypt-hosts to your domain, set tls-listener to :443 and enable force-https.
  116. If you want to use TLS using your own certificates, set tls-listener to :443, force-https, tls-cert=file and tls-private-key.
  117. ## Development
  118. Switched to GO111MODULE
  119. ```bash
  120. go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/
  121. ```
  122. ## Build
  123. If on go < 1.11
  124. ```bash
  125. go get -u -v ./...
  126. ```
  127. ```bash
  128. go build -o transfersh main.go
  129. ```
  130. ## Docker
  131. For easy deployment, we've created a Docker container.
  132. ```bash
  133. docker run --publish 8080:8080 dutchcoders/transfer.sh:latest --provider local --basedir /tmp/
  134. ```
  135. ## Contributions
  136. Contributions are welcome.
  137. ## Creators
  138. **Remco Verhoef**
  139. - <https://twitter.com/remco_verhoef>
  140. - <https://twitter.com/dutchcoders>
  141. **Uvis Grinfelds**
  142. ## Maintainer
  143. **Andrea Spacca**
  144. ## Copyright and license
  145. Code and documentation copyright 2011-2018 Remco Verhoef.
  146. Code released under [the MIT license](LICENSE).