@permaweb/beam
Version:
A hyperbeam cli tool
63 lines (43 loc) • 1.53 kB
Markdown
# beam
A simple cURL clone built with JavaScript that uses the `@permaweb/aoconnect` package.
## Installation
```bash
# Clone the repository
git clone https://github.com/yourusername/beam.git
cd beam
# Install dependencies
npm install
# Install globally
npm install -g .
```
## Usage
```bash
beam [options] <url>
```
### Options
- `-X, --request <method>`: Request method to use (default: "GET")
- `-H, --header <header>`: Pass custom header(s) to server (can be used multiple times)
- `-d, --data <data>`: HTTP POST data
- `-o, --output <file>`: Write to file instead of stdout
- `-v, --verbose`: Make the operation more talkative
- `-f, --file <file>`: Read data from file
- `--raw`: Display raw response data
- `-h, --help`: Display help for command
- `-V, --version`: Output the version number
### Examples
```bash
# Simple GET request
beam https://example.com
# POST request with data
beam -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://example.com/api
# POST request with data from file
beam -X POST -H "Content-Type: application/json" -f data.json https://example.com/api
# Save response to file
beam https://example.com -o response.txt
# Verbose mode
beam -v https://example.com
```
## How it works
The `beam` CLI extracts headers from `-H` flags and data from `-d` flag, then uses the `@permaweb/aoconnect` package's `request` function to make HTTP requests. It organizes the URL, headers, and other parameters into tags that are compatible with the aoconnect API.
## License
MIT