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 5.5 KiB

7 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
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
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
9 years ago
7 years ago
9 years ago
7 years ago
9 years ago
9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. ## Usage
  5. ### Upload:
  6. ```bash
  7. $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt
  8. ```
  9. ### Encrypt & upload:
  10. ```bash
  11. $ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/test.txt
  12. ````
  13. ### Download & decrypt:
  14. ```bash
  15. $ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt
  16. ```
  17. ### Upload to virustotal:
  18. ```bash
  19. $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal
  20. ```
  21. ## Add alias to .bashrc or .zshrc
  22. ### Using curl
  23. ```bash
  24. transfer() {
  25. curl --progress-bar --upload-file "$1" https://transfer.sh/$(basename $1) | tee /dev/null;
  26. }
  27. alias transfer=transfer
  28. ```
  29. ### Using wget
  30. ```bash
  31. transfer() {
  32. wget -t 1 -qO - --method=PUT --body-file="$1" --header="Content-Type: $(file -b --mime-type $1)" https://transfer.sh/$(basename $1);
  33. }
  34. alias transfer=transfer
  35. ```
  36. ## Add alias for fish-shell
  37. ### Using curl
  38. ```fish
  39. function transfer --description 'Upload a file to transfer.sh'
  40. if [ $argv[1] ]
  41. # write to output to tmpfile because of progress bar
  42. set -l tmpfile ( mktemp -t transferXXX )
  43. curl --progress-bar --upload-file "$argv[1]" https://transfer.sh/(basename $argv[1]) >> $tmpfile
  44. cat $tmpfile
  45. command rm -f $tmpfile
  46. else
  47. echo 'usage: transfer FILE_TO_TRANSFER'
  48. end
  49. end
  50. funcsave transfer
  51. ```
  52. ### Using wget
  53. ```fish
  54. function transfer --description 'Upload a file to transfer.sh'
  55. if [ $argv[1] ]
  56. 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])
  57. else
  58. echo 'usage: transfer FILE_TO_TRANSFER'
  59. end
  60. end
  61. funcsave transfer
  62. ```
  63. Now run it like this:
  64. ```bash
  65. $ transfer test.txt
  66. ```
  67. ## Add alias on Windows
  68. Put a file called `transfer.cmd` somewhere in your PATH with this inside it:
  69. ```cmd
  70. @echo off
  71. setlocal
  72. :: use env vars to pass names to PS, to avoid escaping issues
  73. set FN=%~nx1
  74. set FULL=%1
  75. powershell -noprofile -command "$(Invoke-Webrequest -Method put -Infile $Env:FULL https://transfer.sh/$Env:FN).Content"
  76. ```
  77. ## Link aliases
  78. Create direct download link:
  79. https://transfer.sh/1lDau/test.txt --> https://transfer.sh/get/1lDau/test.txt
  80. Inline file:
  81. https://transfer.sh/1lDau/test.txt --> https://transfer.sh/inline/1lDau/test.txt
  82. ## Usage
  83. Parameter | Description | Value | Env
  84. --- | --- | --- | ---
  85. listener | port to use for http (:80) | |
  86. profile-listener | port to use for profiler (:6060)| |
  87. force-https | redirect to https | false |
  88. tls-listener | port to use for https (:443) | |
  89. tls-listener-only | flag to enable tls listener only | |
  90. tls-cert-file | path to tls certificate | |
  91. tls-private-key | path to tls private key | |
  92. http-auth-user | user for basic http auth on upload | |
  93. http-auth-pass | pass for basic http auth on upload | |
  94. temp-path | path to temp folder | system temp |
  95. web-path | path to static web files (for development) | |
  96. ga-key | google analytics key for the front end | |
  97. uservoice-key | user voice key for the front end | |
  98. provider | which storage provider to use | (s3, grdrive or local) |
  99. aws-access-key | aws access key | | AWS_ACCESS_KEY
  100. aws-secret-key | aws access key | | AWS_SECRET_KEY
  101. bucket | aws bucket | | BUCKET
  102. s3-no-multipart | disables s3 multipart upload | false | |
  103. basedir | path storage for local/gdrive provider| |
  104. gdrive-client-json-filepath | path to oauth client json config for gdrive provider| |
  105. gdrive-local-config-path | path to store local transfer.sh config cache for gdrive provider| |
  106. gdrive-chunk-size | chunk size for gdrive upload in megabytes, must be lower than available memory (8 MB) | |
  107. lets-encrypt-hosts | hosts to use for lets encrypt certificates (comma seperated) | |
  108. log | path to log file| |
  109. 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.
  110. If you want to use TLS using your own certificates, set tls-listener to :443, force-https, tls-cert=file and tls-private-key.
  111. ## Development
  112. Make sure your GOPATH is set correctly.
  113. ```bash
  114. go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/
  115. ```
  116. ## Build
  117. ```bash
  118. go build -o transfersh main.go
  119. ```
  120. ## Docker
  121. For easy deployment, we've created a Docker container.
  122. ```bash
  123. docker run --publish 8080:8080 dutchcoders/transfer.sh:latest --provider local --basedir /tmp/
  124. ```
  125. ## Contributions
  126. Contributions are welcome.
  127. ## Creators
  128. **Remco Verhoef**
  129. - <https://twitter.com/remco_verhoef>
  130. - <https://twitter.com/dutchcoders>
  131. **Uvis Grinfelds**
  132. ## Maintainer
  133. **Andrea Spacca**
  134. ## Copyright and license
  135. Code and documentation copyright 2011-2018 Remco Verhoef.
  136. Code released under [the MIT license](LICENSE).