1.2.0 • Published 5 years ago

carl-cli v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

carl

A Node.JS replacement for curl

How to install

$ npm install -g carl-cli

How to use

You can just use the URL as an argument to carl:

$ carl pokeapi.co/api/v2/pokemon/1

The previous command will show the following result:

> carl pokeapi.co/api/v2/pokemon/1
Response Status Code: 200
Content-Type: json
Content-Encoding: gzip
Showing a structured version of the body response:
{ abilities:
   [ { ability: [Object], is_hidden: true, slot: 3 },
     { ability: [Object], is_hidden: false, slot: 1 } ],
  base_experience: 64,

It even works with HTML pages:

> carl github.com
Response Status Code: 200
Content-Type: html
Content-Encoding: gzip
Showing a structured version of the body response:
{ title: 'The world’s leading software development platform · GitHub',
  description: 'GitHub is where people build software. More than 31 million people use GitHub to discover, fork, and contribute to over 100 million projects.',
  language: 'en',
  author: undefined,
  publisher: 'GitHub',
  url: 'https://github.com' }

Or, alternatively, use the command prompt:

$ carl
> carl
? Write or paste the url you want to use https://news.ycombinator.com/
Response Status Code: 200
Content-Type: html
Content-Encoding: gzip
Showing a structured version of the body response:
{ title: 'Hacker News',
  description: undefined,
  language: false,
  author: undefined,
  publisher: undefined,
  url: undefined }

Features

  • You can include the protocol in the url, or not. If you don't, carl will use HTTPS by default
  • The currently supported Content-Types are text/html and application/json.
  • For HTML pages, it returns structured data instead of the HTML code.

Are you missing something?

Feel free to open an issue or even opening a pull request.