-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add typescript definitions #3
Labels
Comments
Plus one |
Here's an example for the lib declaration that I use, you can surely use it to include it to the project declare module "node-dig-dns" {
interface MXRecord {
priority: number;
server: string;
}
interface ParsedSection {
domain: string;
type: string;
ttl: string | number;
class: string;
value: string | MXRecord;
}
interface ParsedResult {
header?: ParsedSection[];
question?: ParsedSection[];
answer?: ParsedSection[];
authority?: ParsedSection[];
additional?: ParsedSection[];
time: number;
server: string;
datetime: string;
size: number;
}
interface DigOptions {
/**
* Get the raw output as a string. If `+short` option is passed in `args`, raw output is returned by default.
*/
raw?: boolean;
/**
* Manually set the dig command (e.g., '/my/custom/path/to/dig').
*/
dig?: string;
}
/**
* Parses a DNS section based on its values.
* @param values Array of section values.
* @param section The section type (e.g., 'answer', 'additional').
*/
function parseSection(values: any[], section: string): ParsedSection | any[];
/**
* Parses the output from the `dig` command.
* @param output The raw output from the `dig` command.
* @returns A parsed object containing DNS information.
*/
function parse(output?: string): ParsedResult;
/**
* Runs the `dig` command with given arguments.
* @param args Array of arguments for the `dig` command.
* @param options Options for executing the `dig` command.
* @returns A promise that resolves with the result of the `dig` command.
*/
function dig(args?: string[], options?: DigOptions): Promise<ParsedResult | string>;
export default dig;
} |
Thank you @GregLtrnr. Could you pls add a PR? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As the title suggests =P
The text was updated successfully, but these errors were encountered: