roomie 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +71 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,24 +2,32 @@
2
2
 
3
3
  ![GitHub Sponsors](https://img.shields.io/github/sponsors/nikitacontreras?style=flat-square&label=sponsor%20me&link=https%3A%2F%2Fgithub.com%2Fsponsors%2Fnikitacontreras) ![NPM Version](https://img.shields.io/npm/v/roomie?style=flat-square)
4
4
 
5
+ ---
5
6
 
7
+ ## Introduction
6
8
 
7
- Roomie is a library for analyzing basic metadata of ROM files from various classic consoles. It allows extracting relevant information such as the game name, region, code, ROM and RAM size, version, and other console-specific data.
9
+ **roomie** is a lightweight library for extracting metadata from ROM files of classic gaming consoles. It supports multiple systems and provides detailed information such as game title, region, game code, ROM and RAM sizes, version, and other console-specific data. Designed for simplicity and accuracy, roomie aids developers and enthusiasts in analyzing ROM files programmatically.
10
+
11
+ ---
8
12
 
9
13
  ## Installation
10
14
 
15
+ Install via npm:
16
+
11
17
  ```bash
12
18
  npm install roomie
13
19
  ```
14
20
 
21
+ ---
22
+
15
23
  ## Usage
16
24
 
17
- Roomie supports both CommonJS and ES Module import styles depending on your project setup.
25
+ roomie supports both CommonJS (CJS) and ES Modules (ESM) import styles.
18
26
 
19
27
  ### CommonJS (CJS)
20
28
 
21
29
  ```js
22
- const { Roomie } = require('roomie');
30
+ const Roomie = require("roomie");
23
31
 
24
32
  const romPath = "/path/to/game.sfc";
25
33
  const roomie = new Roomie(romPath);
@@ -49,24 +57,72 @@ await roomie.load(romBuffer);
49
57
  console.log(roomie.info);
50
58
  ```
51
59
 
60
+ ---
61
+
52
62
  ## Supported Consoles
53
63
 
54
- Roomie supports metadata extraction from the following systems:
64
+ | Console | Description |
65
+ |-----------------------------|---------------------------------------------------------------|
66
+ | **Nintendo DS (NDS)** | Extracts game name, region, game code, ROM/RAM size, version, and other metadata. |
67
+ | **Game Boy Advance (GBA)** | Provides title, game code, region, ROM/RAM size, version, and related info. |
68
+ | **Game Boy (GB)** | Retrieves title, cartridge type, ROM/RAM size, and additional metadata. |
69
+ | **Super Nintendo / Super Famicom (SNES/SFC)** | Detects ROM type (HiROM/LoROM), game name, region, code, ROM size, and console-specific fields. |
70
+
71
+ ---
72
+
73
+ ## API Reference
74
+
75
+ ### Constructor
76
+
77
+ ```ts
78
+ new Roomie(pathOrBuffer: string | Buffer)
79
+ ```
80
+
81
+ Creates a new Roomie instance and immediately loads the ROM from the given file path or Buffer. Emits the `'loaded'` event once metadata extraction is complete.
82
+
83
+ ### Methods
84
+
85
+ ```ts
86
+ await roomie.load(pathOrBuffer: string | Buffer): Promise<void>
87
+ ```
88
+
89
+ Loads or reloads a ROM from a file path or Buffer, emitting `'loaded'` on success.
90
+
91
+ ### Properties
92
+
93
+ - `roomie.info: RomInfo` – Object containing extracted ROM metadata.
94
+ - `roomie.rom: Buffer` – Raw bytes of the loaded ROM.
95
+ - `roomie.system: "nds" | "gba" | "gb" | "sfc"` – Detected console system.
96
+
97
+ ### Events
98
+
99
+ - `'loaded'` – Emitted when ROM metadata is successfully loaded and parsed. The listener receives the `info` object.
100
+
101
+ ### Example JSON Output
102
+
103
+ ```json
104
+ {
105
+ "system": "gba",
106
+ "title": "METROID FUSION",
107
+ "gameCode": "AGB-AMME",
108
+ "region": "USA",
109
+ "romSize": 2097152,
110
+ "ramSize": 32768,
111
+ "version": 1,
112
+ "checksum": "0x1234"
113
+ }
114
+ ```
115
+
116
+ ---
55
117
 
56
- - **Nintendo DS (NDS):** Retrieves data such as the game name, region, game code, ROM and RAM size, version, among others.
57
- - **Game Boy Advance (GBA):** Extracts information about the title, game code, region, ROM and RAM size, version, etc.
58
- - **Game Boy (GB):** Provides details about the title, cartridge type, ROM and RAM size, and other metadata.
59
- - **Super Nintendo / Super Famicom (SNES/SFC):** Detects the ROM type (HiROM/LoROM), game name, region, code, ROM size, and other specific fields.
118
+ ## Error Handling
60
119
 
61
- ## API
120
+ If the ROM cannot be identified, the library throws errors with codes:
62
121
 
63
- - `new Roomie(path: string | Buffer)` – Creates an instance and immediately loads the specified ROM file or buffer. Emits the `'loaded'` event when the information is available.
64
- - `await roomie.load(pathOrBuffer: string | Buffer)` – Loads or reloads a different ROM file from a file path or a Buffer.
65
- - `roomie.info: RomInfo` – Object with the analyzed ROM metadata, including system, size, game code, region, and other specific fields.
66
- - `roomie.rom: Buffer` – Contains the raw bytes of the loaded ROM file.
67
- - `roomie.system: "nds" | "gba" | "gb" | "sfc"` – Detected system based on the file extension and content.
122
+ - `unknown_file` – When loading from a file path and the system is unrecognized.
123
+ - `unknown_bytes` – When loading from a Buffer and the system is unrecognized.
68
124
 
69
- If the system cannot be identified, the library throws errors with codes `unknown_file` (when loading from a path) or `unknown_bytes` (when loading from a Buffer).
125
+ ---
70
126
 
71
127
  ## License
72
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roomie",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "ROM metadata helper",
5
5
  "license": "MIT",
6
6
  "type": "module",