https://github.com/runejs/common
Common logging, networking, compression, and other functionality for RuneJS applications.
https://github.com/runejs/common
api buffer bytebuffer common core-services logger runejs runejs-applications
Last synced: about 1 month ago
JSON representation
Common logging, networking, compression, and other functionality for RuneJS applications.
- Host: GitHub
- URL: https://github.com/runejs/common
- Owner: runejs
- License: gpl-3.0
- Created: 2020-10-24T01:11:08.000Z (over 5 years ago)
- Default Branch: develop
- Last Pushed: 2025-01-22T01:35:21.000Z (about 1 year ago)
- Last Synced: 2025-09-25T22:15:36.660Z (5 months ago)
- Topics: api, buffer, bytebuffer, common, core-services, logger, runejs, runejs-applications
- Language: TypeScript
- Homepage:
- Size: 370 KB
- Stars: 4
- Watchers: 4
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://discord.gg/5P74nSh)
[](https://github.com/runejs/)
# Common
Common logging, networking, compression, and other miscellaneous functionality for RuneJS.
## Exported Modules
### `@runejs/common`
* `logger` is exported as a singleton Pino logging wrapper.
* Methods:
* `logger.info(...messages: any[])`
* `logger.debug(...messages: any[])`
* `logger.warn(...messages: any[])`
* `logger.error(...messages: any[])`
* `logger.trace(...messages: any[])`
* `logger.fatal(...messages: any[])`
* `logger.destination(logDir: string)`
* `logger.setOptions(options: Pino.LoggerOptions)`
* `logger.setPrettyPrint(prettyPrint: boolean)`
* `logger.setTimeFormat(format: TimeFn)`
* `ByteBuffer` is also exported at the root level.
* Node `Uint8Array` wrapper with additional utility functions.
* Unified configurable `get` and `put` methods to easily move bytes within the buffer.
* Int24, Smart, Long and String type support.
* Big endian, little endian, and mixed endian support.
* Bit access through `openBitBuffer()`, `putBits()`, and `closeBitBuffer()`
### `@runejs/common/color`
Handles various color conversions needed by the game and tooling.
* `RGB(A)`
* `HSL` (Hue, Saturation, Lightness)
* `HSV` (Hue, Saturation, Value/Brightness)
* `HCL` (Hue, Chroma, Luminance)
* `LAB` (Lightness, A, B)
### `@runejs/common/compress`
* Exported class `Gzip` handles Gzip compression and decompression.
* Exported class `Bzip2` handles Bzip2 compression and decompression.
### `@runejs/common/crc32`
Exports a single class `Crc32` that generates CRC32 checksums for binary data files.
### `@runejs/common/encrypt`
Provides XTEA encryption and decryption functionality, as well as a key file loader.
* Exported as class `Xtea`
### `@runejs/common/net`
* `SocketServer`
* Handles connections made to a RuneJS socket server.
* `SocketServer.launch(serverName, hostName, port, connectionHandlerFactory)`
* Spins up a new Node Socket server with the specified host and port.
* `ServerConfigOptions`
* Options for a configured Socket server, imported using the `parseServerConfig()` function.