mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
default stdout
This commit is contained in:
parent
f2e420cd2c
commit
dccaff32cf
2 changed files with 7 additions and 6 deletions
11
README.md
11
README.md
|
@ -48,12 +48,12 @@ go get github.com/schollz/croc
|
|||
To send a file, simply do:
|
||||
|
||||
```
|
||||
$ croc send FILE
|
||||
Sending 'FILE' (X MB)
|
||||
$ croc send file-or-folder
|
||||
Sending 'file-or-folder' (X MB)
|
||||
Code is: code-phrase
|
||||
```
|
||||
|
||||
Them to receive the file on another computer, you can just do
|
||||
Them to receive the file (or folder) on another computer, you can just do
|
||||
|
||||
```
|
||||
$ croc code-phrase
|
||||
|
@ -61,6 +61,7 @@ $ croc code-phrase
|
|||
|
||||
The code phrase is used to establish password-authenticated key agreement ([PAKE](https://en.wikipedia.org/wiki/Password-authenticated_key_agreement)) which generates a secret key for the sender and recipient to use for end-to-end encryption.
|
||||
|
||||
|
||||
### Custom code phrase
|
||||
|
||||
You can send with your own code phrase (must be more than 4 characters).
|
||||
|
@ -78,10 +79,10 @@ You can pipe to `croc`:
|
|||
$ cat [filename] | croc send
|
||||
```
|
||||
|
||||
In this case `croc` will automatically use the stdin data and send and assign a filename like "croc-stdin-123456789". To receive to `stdout` at you can always just use the `--yes` and `--stdout` flags which will automatically approve the transfer and pipe it out to `stdout`.
|
||||
In this case `croc` will automatically use the stdin data and send and assign a filename like "croc-stdin-123456789". To receive to `stdout` at you can always just use the `--yes` will automatically approve the transfer and pipe it out to `stdout`.
|
||||
|
||||
```
|
||||
$ croc --yes --stdout [code-phrase] > out
|
||||
$ croc --yes [code-phrase] > out
|
||||
```
|
||||
|
||||
All of the other text printed to the console is going to `stderr` so it will not interfere with the message going to `stdout`.
|
||||
|
|
|
@ -746,7 +746,7 @@ func (c *Client) receiveData(i int) {
|
|||
if c.TotalChunksTransfered == len(c.CurrentFileChunks) || c.TotalSent == c.FilesToTransfer[c.FilesToTransferCurrentNum].Size {
|
||||
log.Debug("finished receiving!")
|
||||
c.CurrentFile.Close()
|
||||
if c.Options.Stdout {
|
||||
if c.Options.Stdout || strings.HasPrefix(c.FilesToTransfer[c.FilesToTransferCurrentNum].Name,"croc-stdin") {
|
||||
pathToFile := path.Join(
|
||||
c.FilesToTransfer[c.FilesToTransferCurrentNum].FolderRemote,
|
||||
c.FilesToTransfer[c.FilesToTransferCurrentNum].Name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue