curl-to-node

0.1.0 • Public • Published

curl-to-node

Build Status

Transform curl CLI commands to js options for http requests libraries.

Install

$ npm install curl-to-node --save

Usage

import curlToNode from 'curl-to-node';
import got from 'got';
 
const str = `curl https://api.github.com/users/ewnd9 \
  -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0' \
  -H 'Accept: application/json, text/javascript, */*; q=0.01'`;
 
got.apply(got, curlToNode('got', str))
  .then(response => {
    console.log(response.body);
  })
  .catch(error => {
    console.log(error.response.body);
  });

Roadmap

  • got
    • -X <method>
    • -H <header>
    • --compressed
  • superagent
    • nothing has been done yet

License

MIT © ewnd9

Readme

Keywords

Package Sidebar

Install

npm i curl-to-node

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • ewnd9