Skip to content

Commit cd49fa2

Browse files
committed
update readme and remove test workflows
1 parent 6b39bd1 commit cd49fa2

File tree

3 files changed

+5
-123
lines changed

3 files changed

+5
-123
lines changed

.github/workflows/coverage.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 5 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,16 @@
1-
# minestat-es
1+
# git-clone-sparse
22

3-
[![Package Version](https://badge.fury.io/js/minestat-es.svg)](https://www.npmjs.com/package/minestat-es)
4-
[![Code Coverage](https://codecov.io/gh/ayan4m1/minestat-es/branch/main/graph/badge.svg?token=UKTTU7XNAM)](https://codecov.io/gh/ayan4m1/minestat-es)
3+
[![Package Version](https://badge.fury.io/js/git-clone-sparse.svg)](https://www.npmjs.com/package/git-clone-sparse)
54

65
## features
76

87
- Written in TypeScript
9-
- Less than 5kB of code
10-
- No runtime dependencies
11-
- Supports ESM and CommonJS
12-
- Comprehensive unit tests
8+
- Small footprint
139

1410
## requirements
1511

16-
- Node 16+
12+
- Node 18+
1713

1814
## usage
1915

20-
### by address/port
21-
22-
To query a Minecraft server using an IP/hostname and a port, use:
23-
24-
```ts
25-
fetchServerInfo({
26-
address: '1.2.3.4',
27-
port: 25565,
28-
timeout: 1000
29-
});
30-
```
31-
32-
### by hostname
33-
34-
To perform an SRV record lookup and query a Minecraft server using only a hostname, use:
35-
36-
```ts
37-
fetchServerInfo({
38-
hostname: 'example.com',
39-
timeout: 1000
40-
});
41-
```
42-
43-
Regardless of which way it was invoked, `fetchServerInfo` returns a promise which will resolve with an object containing the following properties:
44-
45-
| Key | Type | Description |
46-
| ------ | --------- | ----------------------------------- |
47-
| online | `boolean` | Whether the server is online or not |
48-
49-
If the server is offline, the object will also contain the properties:
50-
51-
| Key | Type | Description |
52-
| ----- | ------- | ----------------------------------------------------- |
53-
| error | `Error` | A communications or validation error, if one occurred |
54-
55-
If the server is online, the object will also contain the following properties:
56-
57-
| Key | Type | Description |
58-
| ---------- | -------- | ------------------------------------------------- |
59-
| version | `string` | The server's version string |
60-
| motd | `string` | The server's Message of the Day |
61-
| players | `number` | The number of players on the server |
62-
| maxPlayers | `number` | The maximum number of players the server supports |
63-
64-
`fetchServerInfo` rejects if an error occurs during SRV record resolution.
65-
66-
## example
67-
68-
```ts
69-
import { fetchServerInfo } from 'minestat-es';
70-
71-
(async () => {
72-
try {
73-
// query by hostname (SRV lookup)
74-
const { online, error, players } = await fetchServerInfo({
75-
hostname: 'mc.example.com'
76-
});
77-
78-
// OR
79-
80-
// query by address/port
81-
const { online, error, players } = await fetchServerInfo({
82-
address: 'example.com', // could also be an IP address
83-
port: 25565
84-
});
85-
86-
// interpret the results
87-
console.log(`Server is ${online ? 'Online' : 'Offline'}`);
88-
if (online) {
89-
console.log(`There are ${players} player(s) online.`);
90-
} else if (error) {
91-
// either the SRV record failed to resolve, a socket error occurred,
92-
// or the response from the server was invalid
93-
console.error(error);
94-
}
95-
} catch (error) {
96-
// an unexpected error occurred
97-
console.error(error);
98-
}
99-
})();
100-
```
16+
**TODO**

0 commit comments

Comments
 (0)