-
Notifications
You must be signed in to change notification settings - Fork 105
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
typescript definition file? #53
Comments
No. I guess we don't have such definition yet. What else I can help although I am not familiar with the typescript at all :D |
It would be a good thing to add; i'll play with creating one of my own in the meantime. |
@vrmerlin any progress? |
This may not be completely exhaustive, and may not be 100% accurate, but it's a starting point: declare module 'ping' {
export interface PingConfig {
/**
* Map IP address to hostname or not. Default `true`
*/
numeric?: boolean;
/**
* Time duration, in seconds, for ping command to exit. Default `2` on Mac/Linux, `5` on Windows.
*/
timeout?: number;
/**
* Exit after sending number of `ECHO_REQUEST`. Default `1`
*/
min_reply?: number;
/**
* Ping via ipv6 or not. Default `false`
*/
v6?: boolean;
/**
* Source address for sending the ping
*/
sourceAddr?: string;
/**
* Additional arguments. Default `[]`
*/
extra?: string[];
}
export interface PingResponse {
/**
* The input IP address or host
*/
host: string;
/**
* Numeric target IP address
*/
numeric_host?: string;
/**
* `true` for existing host
*/
alive: boolean;
/**
* Raw stdout from system ping
*/
output: string;
/**
* Time (float) in ms for first successful ping response
*/
time: number;
/**
* Array of Time (float) in ms for each ping response
*/
times: number[];
/**
* Minimum time for collection records
*/
min: string;
/**
* Maximum time for collection records
*/
max: string;
/**
* Average time for collection records
*/
avg: string;
/**
* Standard deviation time for collected records
*/
stddev: string;
}
export const sys: {
/**
* Performs a system ping utility.
*
* @param addr Hostname or IP address
* @param cb Response callback.
* First argument is successful response boolean.
* Second argument is any error, `null` if no error.
* @param config Optional configuration
*/
probe(addr: string, cb: (isAlive: boolean, error: any) => void, config?: PingConfig): void;
}
export const promise: {
/**
* Performs a system ping utility.
*
* @param addr Hostname or IP address
* @param config Optional configuration
*/
probe(addr: string, config?: PingConfig): Promise<PingResponse>;
}
} |
I know this an old issue, but for the sake of anyone still looking for a typescript type file, i am the creator of pingman module based on this one, but complete with ts types and couple of other features. Its also has a much more smaller unpacked size due to using only core node features and having no dependencies. It would be great if you guys could check it out. |
maybe a PR would help here, please |
Is there a definition file for this module? I couldn't find one, and am having problems trying to create one of my own.
Thanks,
John
The text was updated successfully, but these errors were encountered: