Skip to content

Commit 6419046

Browse files
committed
Add arguments to example-raw.js
1 parent 1951e16 commit 6419046

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

samples/example-raw.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
//const getdns = require("getdns");
99
const getdns = require("../");
1010

11+
// Usage: node example-raw.js [hostname] [record type]
12+
// Usage: node example-raw.js hostname.example.com AAAA
13+
const hostname = process.argv[2] || "labs.verisigninc.com";
14+
const recordTypeCode = process.argv[3] || "A";
15+
const recordType = getdns["RRTYPE_" + recordTypeCode.toUpperCase()];
16+
1117
const options = {
1218
// Request timeout time in milliseconds.
1319
timeout: 5000,
@@ -41,7 +47,7 @@ const context = getdns.createContext(options);
4147
// Last argument must be a callback.
4248
// Returns a transaction id, which may be used to cancel the request.
4349
/* eslint-disable no-unused-vars */
44-
const transactionId = context.general("labs.verisigninc.com", getdns.RRTYPE_A, callback);
50+
const transactionId = context.general(hostname, recordType, callback);
4551
/* eslint-disable no-unused-vars */
4652

4753
// Cancel a request.

0 commit comments

Comments
 (0)