|
1 | 1 | [](https://discord.gg/5P74nSh) |
2 | 2 |
|
3 | | - |
4 | | - |
5 | | - |
6 | | -# @runejs/common |
7 | | - |
8 | | -Common logging, networking, compression, and other additional functionality for RuneJS applications. |
9 | | - |
10 | | -### @runejs/common |
11 | | -* `logger` is exported as a singleton Pino logging wrapper, offering the following functions: |
12 | | - * `logger.info(...messages)` |
13 | | - * `logger.debug(...messages)` |
14 | | - * `logger.warn(...messages)` |
15 | | - * `logger.error(...messages)` |
16 | | - * `logger.fatal(...messages)` |
17 | | - * `logger.trace(...messages)` |
18 | | -* Ability to set the Pino logging date/time formatting function via `setLoggerTimeFn(Pino.TimeFn)` |
19 | | -* Ability to set the Pino logging pretty print config value via `setLoggerPrettyPrint(boolean)` |
20 | | -* Setting of _all_ Pino logging options via `setLoggerOptions(Pino.LoggerOptions)` |
21 | | - |
22 | | -### @runejs/common/buffer |
23 | | -* `ByteBuffer` is the main export. |
| 3 | +[](https://github.com/runejs/) |
| 4 | + |
| 5 | +# Common |
| 6 | + |
| 7 | +Common logging, networking, compression, and other miscellaneous functionality for RuneJS. |
| 8 | + |
| 9 | +## Exported Modules |
| 10 | + |
| 11 | +### `@runejs/common` |
| 12 | +* `logger` is exported as a singleton Pino logging wrapper. |
| 13 | + * Methods: |
| 14 | + * `logger.info(...messages: any[])` |
| 15 | + * `logger.debug(...messages: any[])` |
| 16 | + * `logger.warn(...messages: any[])` |
| 17 | + * `logger.error(...messages: any[])` |
| 18 | + * `logger.trace(...messages: any[])` |
| 19 | + * `logger.fatal(...messages: any[])` |
| 20 | + * `logger.destination(logDir: string)` |
| 21 | + * `logger.setOptions(options: Pino.LoggerOptions)` |
| 22 | + * `logger.setPrettyPrint(prettyPrint: boolean)` |
| 23 | + * `logger.setTimeFormat(format: TimeFn)` |
| 24 | +* `ByteBuffer` is also exported at the root level. |
24 | 25 | * Node `Uint8Array` wrapper with additional utility functions. |
25 | 26 | * Unified configurable `get` and `put` methods to easily move bytes within the buffer. |
26 | 27 | * Int24, Smart, Long and String type support. |
27 | 28 | * Big endian, little endian, and mixed endian support. |
28 | 29 | * Bit access through `openBitBuffer()`, `putBits()`, and `closeBitBuffer()` |
29 | 30 |
|
30 | | -### @runejs/common/net |
31 | | -* `SocketServer` |
32 | | - * Handles connections made to a RuneJS socket server. |
33 | | -* `SocketServer.launch(serverName, hostName, port, connectionHandlerFactory)` |
34 | | - * Spins up a new Node Socket server with the specified host and port. |
35 | | -* `ServerConfigOptions` |
36 | | - * Options for a configured Socket server, imported using the `parseServerConfig()` function. |
| 31 | +### `@runejs/common/color` |
| 32 | +Handles various color conversions needed by the game and tooling. |
| 33 | +* `RGB(A)` |
| 34 | +* `HSL` (Hue, Saturation, Lightness) |
| 35 | +* `HSV` (Hue, Saturation, Value/Brightness) |
| 36 | +* `HCL` (Hue, Chroma, Luminance) |
| 37 | +* `LAB` (Lightness, A, B) |
37 | 38 |
|
38 | | -### @runejs/common/compression |
| 39 | +### `@runejs/common/compress` |
39 | 40 | * Exported class `Gzip` handles Gzip compression and decompression. |
40 | 41 | * Exported class `Bzip2` handles Bzip2 compression and decompression. |
41 | 42 |
|
42 | | -### @runejs/common/encryption |
| 43 | +### `@runejs/common/crc32` |
| 44 | +Exports a single class `Crc32` that generates CRC32 checksums for binary data files. |
| 45 | + |
| 46 | +### `@runejs/common/encrypt` |
43 | 47 | Provides XTEA encryption and decryption functionality, as well as a key file loader. |
44 | 48 | * Exported as class `Xtea` |
45 | 49 |
|
46 | | -### @runejs/common/color |
47 | | -Handles various color conversions needed by the game and tooling. |
48 | | -* `RGB(A)` |
49 | | -* `HSL` (Hue, Saturation, Lightness) |
50 | | -* `HSV` (Hue, Saturation, Value/Brightness) |
51 | | -* `HCL` (Hue, Chroma, Luminance) |
52 | | -* `LAB` (Lightness, A, B) |
| 50 | +### `@runejs/common/net` |
| 51 | +* `SocketServer` |
| 52 | + * Handles connections made to a RuneJS socket server. |
| 53 | +* `SocketServer.launch(serverName, hostName, port, connectionHandlerFactory)` |
| 54 | + * Spins up a new Node Socket server with the specified host and port. |
| 55 | +* `ServerConfigOptions` |
| 56 | + * Options for a configured Socket server, imported using the `parseServerConfig()` function. |
0 commit comments