CLI version of the client #2
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a command-line interface (CLI) client for YSTP, allowing you to share files directly from the terminal without needing to use the web interface.
Features
Commands
ystp send <file>- Sends a file and returns a shareable 5-word mnemonic codeystp receive <code>- Receives a file using the shareable code--output <filename>- Optional flag to specify output filename when receivingOptions
--host <hostname>- Connect to a different host (default: localhost)--port <port>- Connect to a different port (default: 8787)Protocol Implementation
The CLI follows the exact WebSocket protocol:
EOFmarker to signal end of transferLET_IT_RIPapproval mechanism for receiver consentUsage Examples
Send a file:
Or after running
npm link:Output:
Receive a file:
Or with a custom output filename:
Output:
Connect to a different server:
Changes Made
New Files
cli/ystp.js- Full-featured CLI client implementationModified Files
package.json- Addedwsdependency and bin entry pointInstallation
After merging, users can:
Technical Details
wspackage for WebSocket client implementation in Node.jswss://(secure) andws://(insecure) protocols