update tsconfig
This commit is contained in:
parent
0837945b81
commit
83cd9507ac
@ -5,17 +5,26 @@
|
|||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartping",
|
"gitrepo": "smartping",
|
||||||
"description": "a ping utility",
|
"description": "A utility for performing ping operations in Node.js environments.",
|
||||||
"npmPackagename": "@push.rocks/smartping",
|
"npmPackagename": "@push.rocks/smartping",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "push.rocks"
|
"projectDomain": "push.rocks",
|
||||||
|
"keywords": [
|
||||||
|
"ping",
|
||||||
|
"network",
|
||||||
|
"connectivity",
|
||||||
|
"Node.js",
|
||||||
|
"utility",
|
||||||
|
"async",
|
||||||
|
"promise"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
},
|
},
|
||||||
"tsdocs": {
|
"tsdoc": {
|
||||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
11
package.json
11
package.json
@ -2,7 +2,7 @@
|
|||||||
"name": "@push.rocks/smartping",
|
"name": "@push.rocks/smartping",
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a ping utility",
|
"description": "A utility for performing ping operations in Node.js environments.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -40,5 +40,14 @@
|
|||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"ping",
|
||||||
|
"network",
|
||||||
|
"connectivity",
|
||||||
|
"Node.js",
|
||||||
|
"utility",
|
||||||
|
"async",
|
||||||
|
"promise"
|
||||||
]
|
]
|
||||||
}
|
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
138
readme.md
138
readme.md
@ -1,39 +1,123 @@
|
|||||||
# @pushrocks/smartping
|
# @push.rocks/smartping
|
||||||
a ping utility
|
a ping utility
|
||||||
|
|
||||||
## Availabililty and Links
|
## Install
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartping)
|
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartping)
|
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/smartping)
|
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartping/)
|
|
||||||
|
|
||||||
## Status for master
|
To install `@push.rocks/smartping`, run the following command in your project directory:
|
||||||
|
|
||||||
Status Category | Status Badge
|
```bash
|
||||||
-- | --
|
npm install @push.rocks/smartping --save
|
||||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartping/badges/master/pipeline.svg)](https://lossless.cloud)
|
```
|
||||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartping/badges/master/coverage.svg)](https://lossless.cloud)
|
|
||||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartping)](https://lossless.cloud)
|
This command adds `@push.rocks/smartping` to your project's dependencies and ensures you can begin utilizing it to manage your network ping needs efficiently.
|
||||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartping)](https://lossless.cloud)
|
|
||||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
|
||||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
||||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
|
||||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartping)](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartping)](https://lossless.cloud)
|
|
||||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartping)](https://lossless.cloud)
|
|
||||||
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class intellisense
|
`@push.rocks/smartping` leverages TypeScript and ESM syntax for a seamless development experience, offering straightforward methods to conduct ping operations within your applications.
|
||||||
|
|
||||||
## Contribution
|
Before diving into the usage scenarios, ensure that you import the module in your TypeScript files using:
|
||||||
|
|
||||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
```typescript
|
||||||
|
import { Smartping } from '@push.rocks/smartping';
|
||||||
|
```
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
### Basic Ping
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
To perform a basic ping operation to check the reachability of a host, you can do the following:
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
|
||||||
|
|
||||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
```typescript
|
||||||
|
import { Smartping } from '@push.rocks/smartping';
|
||||||
|
|
||||||
|
const pingInstance = new Smartping();
|
||||||
|
|
||||||
|
async function basicPing() {
|
||||||
|
const pingResponse = await pingInstance.ping('google.com');
|
||||||
|
console.log(pingResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
basicPing();
|
||||||
|
```
|
||||||
|
|
||||||
|
This will output the ping response from `google.com`, including whether the host is alive, the time it took for the response, and other detailed information.
|
||||||
|
|
||||||
|
### Ping with Timeout
|
||||||
|
|
||||||
|
Sometimes, you may want to specify a timeout for the ping operation to avoid long waiting times if the host is not reachable. You can easily do this as follows:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Smartping } from '@push.rocks/smartping';
|
||||||
|
|
||||||
|
const pingInstance = new Smartping();
|
||||||
|
|
||||||
|
async function pingWithTimeout() {
|
||||||
|
const pingResponse = await pingInstance.ping('google.com', 1000); // Timeout set to 1000 milliseconds
|
||||||
|
console.log(pingResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
pingWithTimeout();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checking if Host is Alive
|
||||||
|
|
||||||
|
If you're only interested in whether a host is alive without the need for detailed ping information, you can use the `pingAlive` method:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Smartping } from '@push.rocks/smartping';
|
||||||
|
|
||||||
|
const pingInstance = new Smartping();
|
||||||
|
|
||||||
|
async function checkHostAlive() {
|
||||||
|
const isAlive = await pingInstance.pingAlive('google.com');
|
||||||
|
console.log(`Is Google alive? ${isAlive}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkHostAlive();
|
||||||
|
```
|
||||||
|
|
||||||
|
This method is particularly useful for quickly verifying the availability of a server or an API endpoint.
|
||||||
|
|
||||||
|
### Advanced Usage Scenarios
|
||||||
|
|
||||||
|
`@push.rocks/smartping` can be integrated into health-check mechanisms, automated network diagnostics, server monitoring tools, or any application requiring network communication verification. Its straightforward API and promise-based architecture allow it to be seamlessly incorporated into asynchronous flow control, enhancing both the development experience and performance.
|
||||||
|
|
||||||
|
### Error Handling
|
||||||
|
|
||||||
|
While using `@push.rocks/smartping`, you might encounter errors, particularly when dealing with unreachable hosts or network issues. It is recommended to implement proper error handling to manage such scenarios gracefully:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
async function safePingWithTimeout() {
|
||||||
|
try {
|
||||||
|
const pingResponse = await pingInstance.ping('google.com', 500);
|
||||||
|
console.log(pingResponse);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Ping operation failed:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
safePingWithTimeout();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Wrapping Up
|
||||||
|
|
||||||
|
Whether integrating into existing applications for network diagnostics or constructing a new solution requiring ping capabilities, `@push.rocks/smartping` provides an efficient and easy-to-use interface to accomplish these tasks with minimal code. Its design and implementation cater to modern development practices, promoting clean and maintainable code.
|
||||||
|
|
||||||
|
For more complex scenarios or contributions, please consult the documentation and source code available on GitHub and NPM. Contributions are always welcome to enhance the module's capabilities and address the evolving needs of developers and applications alike.
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||||
|
Loading…
Reference in New Issue
Block a user