Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

README.md 7.2 KiB

7 anos atrás
9 anos atrás
9 anos atrás
5 anos atrás
5 anos atrás
5 anos atrás
5 anos atrás
9 anos atrás
9 anos atrás
9 anos atrás
9 anos atrás
9 anos atrás
9 anos atrás
9 anos atrás
9 anos atrás
7 anos atrás
7 anos atrás
9 anos atrás
9 anos atrás
7 anos atrás
9 anos atrás
7 anos atrás
9 anos atrás
7 anos atrás
7 anos atrás
5 anos atrás
7 anos atrás
5 anos atrás
4 anos atrás
7 anos atrás
7 anos atrás
7 anos atrás
5 anos atrás
9 anos atrás
5 anos atrás
7 anos atrás
9 anos atrás
7 anos atrás
9 anos atrás
9 anos atrás
9 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. ### Deleting
  25. ```bash
  26. $ curl -X DELETE <X-Url-Delete Response Header URL>
  27. ```
  28. ## Request Headers
  29. ### Max-Downloads
  30. ```bash
  31. $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Downloads: 1" # Limit the number of downloads
  32. ```
  33. ### Max-Days
  34. ```bash
  35. $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Days: 1" # Set the number of days before deletion
  36. ```
  37. ## Response Headers
  38. ### X-Url-Delete
  39. The URL used to request the deletion of a file. Returned as a response header.
  40. ```bash
  41. curl -sD - --upload-file ./hello https://transfer.sh/hello.txt | grep 'X-Url-Delete'
  42. X-Url-Delete: https://transfer.sh/hello.txt/BAYh0/hello.txt/PDw0NHPcqU
  43. ```
  44. ## Add alias to .bashrc or .zshrc
  45. ### Using curl
  46. ```bash
  47. transfer() {
  48. curl --progress-bar --upload-file "$1" https://transfer.sh/$(basename "$1") | tee /dev/null;
  49. echo
  50. }
  51. alias transfer=transfer
  52. ```
  53. ### Using wget
  54. ```bash
  55. transfer() {
  56. wget -t 1 -qO - --method=PUT --body-file="$1" --header="Content-Type: $(file -b --mime-type "$1")" https://transfer.sh/$(basename "$1");
  57. echo
  58. }
  59. alias transfer=transfer
  60. ```
  61. ## Add alias for fish-shell
  62. ### Using curl
  63. ```fish
  64. function transfer --description 'Upload a file to transfer.sh'
  65. if [ $argv[1] ]
  66. # write to output to tmpfile because of progress bar
  67. set -l tmpfile ( mktemp -t transferXXXXXX )
  68. curl --progress-bar --upload-file "$argv[1]" https://transfer.sh/(basename $argv[1]) >> $tmpfile
  69. cat $tmpfile
  70. command rm -f $tmpfile
  71. else
  72. echo 'usage: transfer FILE_TO_TRANSFER'
  73. end
  74. end
  75. funcsave transfer
  76. ```
  77. ### Using wget
  78. ```fish
  79. function transfer --description 'Upload a file to transfer.sh'
  80. if [ $argv[1] ]
  81. 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])
  82. else
  83. echo 'usage: transfer FILE_TO_TRANSFER'
  84. end
  85. end
  86. funcsave transfer
  87. ```
  88. Now run it like this:
  89. ```bash
  90. $ transfer test.txt
  91. ```
  92. ## Add alias on Windows
  93. Put a file called `transfer.cmd` somewhere in your PATH with this inside it:
  94. ```cmd
  95. @echo off
  96. setlocal
  97. :: use env vars to pass names to PS, to avoid escaping issues
  98. set FN=%~nx1
  99. set FULL=%1
  100. powershell -noprofile -command "$(Invoke-Webrequest -Method put -Infile $Env:FULL https://transfer.sh/$Env:FN).Content"
  101. ```
  102. ## Link aliases
  103. Create direct download link:
  104. https://transfer.sh/1lDau/test.txt --> https://transfer.sh/get/1lDau/test.txt
  105. Inline file:
  106. https://transfer.sh/1lDau/test.txt --> https://transfer.sh/inline/1lDau/test.txt
  107. ## Usage
  108. Parameter | Description | Value | Env
  109. --- | --- | --- | ---
  110. listener | port to use for http (:80) | |
  111. profile-listener | port to use for profiler (:6060)| |
  112. force-https | redirect to https | false |
  113. tls-listener | port to use for https (:443) | |
  114. tls-listener-only | flag to enable tls listener only | |
  115. tls-cert-file | path to tls certificate | |
  116. tls-private-key | path to tls private key | |
  117. http-auth-user | user for basic http auth on upload | |
  118. http-auth-pass | pass for basic http auth on upload | |
  119. ip-whitelist | comma separated list of ips allowed to connect to the service | |
  120. ip-blacklist | comma separated list of ips not allowed to connect to the service | |
  121. temp-path | path to temp folder | system temp |
  122. web-path | path to static web files (for development or custom front end) | |
  123. proxy-path | path prefix when service is run behind a proxy | |
  124. ga-key | google analytics key for the front end | |
  125. uservoice-key | user voice key for the front end | |
  126. provider | which storage provider to use | (s3, gdrive or local) |
  127. aws-access-key | aws access key | | AWS_ACCESS_KEY
  128. aws-secret-key | aws access key | | AWS_SECRET_KEY
  129. bucket | aws bucket | | BUCKET
  130. s3-region | region of the s3 bucket | eu-west-1 | S3_REGION
  131. s3-no-multipart | disables s3 multipart upload | false | |
  132. s3-path-style | Forces path style URLs, required for Minio. | false | |
  133. basedir | path storage for local/gdrive provider| |
  134. gdrive-client-json-filepath | path to oauth client json config for gdrive provider| |
  135. gdrive-local-config-path | path to store local transfer.sh config cache for gdrive provider| |
  136. gdrive-chunk-size | chunk size for gdrive upload in megabytes, must be lower than available memory (8 MB) | |
  137. lets-encrypt-hosts | hosts to use for lets encrypt certificates (comma seperated) | |
  138. log | path to log file| |
  139. 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.
  140. If you want to use TLS using your own certificates, set tls-listener to :443, force-https, tls-cert=file and tls-private-key.
  141. ## Development
  142. Switched to GO111MODULE
  143. ```bash
  144. go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/
  145. ```
  146. ## Build
  147. If on go < 1.11
  148. ```bash
  149. go get -u -v ./...
  150. ```
  151. ```bash
  152. go build -o transfersh main.go
  153. ```
  154. ## Docker
  155. For easy deployment, we've created a Docker container.
  156. ```bash
  157. docker run --publish 8080:8080 dutchcoders/transfer.sh:latest --provider local --basedir /tmp/
  158. ```
  159. ## S3 Usage
  160. For the usage with a AWS S3 Bucket, you just need to specify the following options:
  161. - provider
  162. - aws-access-key
  163. - aws-secret-key
  164. - bucket
  165. - s3-region
  166. If you specify the s3-region, you don't need to set the endpoint URL since the correct endpoint will used automatically.
  167. ### Custom S3 providers
  168. To use a custom non-AWS S3 provider, you need to specify the endpoint as definied from your cloud provider.
  169. ## Contributions
  170. Contributions are welcome.
  171. ## Creators
  172. **Remco Verhoef**
  173. - <https://twitter.com/remco_verhoef>
  174. - <https://twitter.com/dutchcoders>
  175. **Uvis Grinfelds**
  176. ## Maintainer
  177. **Andrea Spacca**
  178. ## Copyright and license
  179. Code and documentation copyright 2011-2018 Remco Verhoef.
  180. Code released under [the MIT license](LICENSE).