🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

format-curl

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

format-curl

Format curl execution from request params

Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
19
-26.92%
Maintainers
2
Weekly downloads
 
Created
Source

format-curl

Format curl execution from request params

Installation

npm install --save format-curl

Usage

import curl from 'format-curl';

const params = {
    url: 'https://myhost.com',
    query: {
        param: 'value'
    },
    headers: {
        'x-header': 'test',
        'x-header2': 'test2'
    },
    body: JSON.stringify({
        param: '123'
    }),
    method: 'PUT',
    args: ['-vvv']
};

console.log(curl(params));
// curl -vvv "https://myhost.com?param=value" -H "x-header: test" -H "x-header2: test2" --data '{"param":"123"}' -X PUT

See test.js for more examples!

TODO

  • URL class as param
  • host/port/scheme/path/hash as params
  • user-argent, cookies as a params (and as curl arguments)

Keywords

curl

FAQs

Package last updated on 04 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts