Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paulkinlan/domcurl
cUrl-like utility for fetching a resource (in this case we will run JS and return after network is idle) - great for JS heavy apps
https://github.com/paulkinlan/domcurl
curl pupeteer
Last synced: about 1 month ago
JSON representation
cUrl-like utility for fetching a resource (in this case we will run JS and return after network is idle) - great for JS heavy apps
- Host: GitHub
- URL: https://github.com/paulkinlan/domcurl
- Owner: PaulKinlan
- License: apache-2.0
- Created: 2018-02-22T12:34:01.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-20T17:01:47.000Z (over 1 year ago)
- Last Synced: 2024-10-14T08:22:34.342Z (2 months ago)
- Topics: curl, pupeteer
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/domcurl
- Size: 125 KB
- Stars: 85
- Watchers: 6
- Forks: 12
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# domcurl
cUrl-like utility for fetching a resource (in this case we will run JS and
return after network is idle) - great for JS heavy apps.## Installation
`npm i domcurl`
## Usage
### Basic usage
`domcurl [url]`
or
`domcurl --url https://example.com`
```
Example Domain
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 50px;
background-color: #fff;
border-radius: 1em;
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
body {
background-color: #fff;
}
div {
width: auto;
margin: 0 auto;
border-radius: 0;
padding: 1em;
}
}
Example Domain
This domain is established to be used for illustrative examples in documents. You may use this
domain in examples without prior coordination or asking for permission.
```
### Verbose output
Renders more details about the request and the response.
`domcurl -v [url]`
```
> GET /
> Host: example.com
> upgrade-insecure-requests: 1
> user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/66.0.3347.0 Safari/537.36
< date: Wed, 28 Feb 2018 03:04:47 GMT
< content-encoding: gzip
< last-modified: Fri, 09 Aug 2013 23:54:35 GMT
< server: ECS (oxr/837E)
< etag: "1541025663+gzip"
< vary: Accept-Encoding
< x-cache: HIT
< content-type: text/html
< status: 200
< cache-control: max-age=604800
< content-length: 606
< expires: Wed, 07 Mar 2018 03:04:47 GMTExample Domain
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 50px;
background-color: #fff;
border-radius: 1em;
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
body {
background-color: #fff;
}
div {
width: auto;
margin: 0 auto;
border-radius: 0;
padding: 1em;
}
}
Example Domain
This domain is established to be used for illustrative examples in documents. You may use this
domain in examples without prior coordination or asking for permission.
```
### Send output to a file
`domcurl --url https://example.com -o test.txt`
or
`domcurl --url https://example.com --output test.txt`
### Set a custom header
`domcurl --url https://example.com -H 'x-test:test1' -H 'x-test2:http://test.com'`
### Set a cookie
Sets a cookie on the request. It must be a valid Cookie string.
`domcurl [url] -b "test=hello; Domain=airhorner.com; HttpOnly;"`
Unlike cUrl you can multiple cookies by appending more `-b` arguments
`domcurl [url] -b "test=hello; Domain=airhorner.com; HttpOnly;" -b "hello=world; Domain=airhorner.com; HttpOnly;"`
### Specify a request timeout
By default the command will timeout after 30 seconds. You can specify how long
the command will wait before it errors.`domcurl --url https://example.com -m 60`
or
`domcurl --url https://example.com --max-time 60`
### Specify a trace file
Output a Chrome DevTools trace file (including screenshots.)
`domcurl --url https://example.com --trace test.json`
## Using as a module
`npm i domcurl`
`
const {domcurl} = require('domcurl');domcurl(`https://paul.kinlan.me/`, {});
`