1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

default stdout

This commit is contained in:
Zack Scholl 2019-05-02 16:37:43 -07:00
parent f2e420cd2c
commit dccaff32cf
2 changed files with 7 additions and 6 deletions

View file

@ -48,12 +48,12 @@ go get github.com/schollz/croc
To send a file, simply do: To send a file, simply do:
``` ```
$ croc send FILE $ croc send file-or-folder
Sending 'FILE' (X MB) Sending 'file-or-folder' (X MB)
Code is: code-phrase 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 $ 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. 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 ### Custom code phrase
You can send with your own code phrase (must be more than 4 characters). 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 $ 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`. All of the other text printed to the console is going to `stderr` so it will not interfere with the message going to `stdout`.

View file

@ -746,7 +746,7 @@ func (c *Client) receiveData(i int) {
if c.TotalChunksTransfered == len(c.CurrentFileChunks) || c.TotalSent == c.FilesToTransfer[c.FilesToTransferCurrentNum].Size { if c.TotalChunksTransfered == len(c.CurrentFileChunks) || c.TotalSent == c.FilesToTransfer[c.FilesToTransferCurrentNum].Size {
log.Debug("finished receiving!") log.Debug("finished receiving!")
c.CurrentFile.Close() c.CurrentFile.Close()
if c.Options.Stdout { if c.Options.Stdout || strings.HasPrefix(c.FilesToTransfer[c.FilesToTransferCurrentNum].Name,"croc-stdin") {
pathToFile := path.Join( pathToFile := path.Join(
c.FilesToTransfer[c.FilesToTransferCurrentNum].FolderRemote, c.FilesToTransfer[c.FilesToTransferCurrentNum].FolderRemote,
c.FilesToTransfer[c.FilesToTransferCurrentNum].Name, c.FilesToTransfer[c.FilesToTransferCurrentNum].Name,