Skip to content

Updated with installation and use cases #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,61 @@ Current CURL options that are supported are:
-H, --header
-X, --request

Installation

```cli
npm install curl-to-postmanv2
```

**Usage Examples of the Lib:**

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

```js
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

```js
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

```js
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
Expand All @@ -19,4 +74,4 @@ Usage examples:
./curl2postman -s spec.json

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