Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

curl-to-postmanv2

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

curl-to-postmanv2

Convert a given CURL command to a Postman request

  • 1.8.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

A cURL to POSTMan converter.

Current CURL options that are supported are:

-A, --user-agent
-d, --data
--data-binary
-F, --form
-G, --get
-H, --header
-X, --request

Installation

npm install curl-to-postmanv2

Usage Examples of the Lib:

1. Validate function: Helps you to validate the curl command.

const { validate } = require("curl-to-postmanv2");

let v = validate("curl -X https://google.co.in");
console.log(v); // { result: true }

2. Convert Function: Helps to convert curl to postman

const { convert } = require("curl-to-postmanv2");

let con = convert(
  { type: "string", data: "curl https://google.co.in" },
  (err, result) => {
    if (err) {
      console.log(err);

      process.exit(1);
    }
    console.log(result);
    console.log("data: ", result.output[0].data);
  }
);

3. getMetaData Function: To get meta data for the curl request

const { getMetaData } = require("curl-to-postmanv2");

let meta = getMetaData(
  { type: "string", data: "curl https://google.co.in" },
  (err, result) => {
    if (err) {
      console.log(err);

      process.exit(1);
    }
    console.log(result);
    console.log("data: ", result.output[0].data);
  }
);

Usage examples:

Read spec.json and store the output in output.json after grouping the requests into folders
    ./curl2postman -s spec.json -o output.json -g

Read spec.json and print the output to the console
    ./curl2postman -s spec.json

Read spec.json and print the prettified output to the console
    ./curl2postman -s spec.json -p

FAQs

Package last updated on 17 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc