Skip to content

Commit 2a54572

Browse files
authored
Merge pull request #37 from nimit2801/example/readmeupdate
Updated with installation and use cases
2 parents 95fdb7c + 604632b commit 2a54572

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,61 @@ Current CURL options that are supported are:
1010
-H, --header
1111
-X, --request
1212

13+
Installation
14+
15+
```cli
16+
npm install curl-to-postmanv2
17+
```
18+
19+
**Usage Examples of the Lib:**
20+
21+
**1. Validate function**: Helps you to validate the curl command.
22+
23+
```js
24+
const { validate } = require("curl-to-postmanv2");
25+
26+
let v = validate("curl -X https://google.co.in");
27+
console.log(v); // { result: true }
28+
```
29+
30+
**2. Convert Function**: Helps to convert curl to postman
31+
32+
```js
33+
const { convert } = require("curl-to-postmanv2");
34+
35+
let con = convert(
36+
{ type: "string", data: "curl https://google.co.in" },
37+
(err, result) => {
38+
if (err) {
39+
console.log(err);
40+
41+
process.exit(1);
42+
}
43+
console.log(result);
44+
console.log("data: ", result.output[0].data);
45+
}
46+
);
47+
```
48+
49+
**3. getMetaData Function**: To get meta data for the curl request
50+
51+
```js
52+
const { getMetaData } = require("curl-to-postmanv2");
53+
54+
let meta = getMetaData(
55+
{ type: "string", data: "curl https://google.co.in" },
56+
(err, result) => {
57+
if (err) {
58+
console.log(err);
59+
60+
process.exit(1);
61+
}
62+
console.log(result);
63+
console.log("data: ", result.output[0].data);
64+
}
65+
);
66+
```
67+
1368
Usage examples:
1469

1570
Read spec.json and store the output in output.json after grouping the requests into folders
@@ -19,4 +74,4 @@ Usage examples:
1974
./curl2postman -s spec.json
2075

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

0 commit comments

Comments
 (0)