bun-memory 1.1.6 → 1.1.7

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 +81 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # bun-memory
2
+
3
+ High-performance Windows process memory utilities for [Bun](https://bun.sh) using `bun:ffi` and Win32 APIs.
4
+
5
+ ## Features
6
+
7
+ - Built for Bun runtime and Windows 10/11
8
+ - Efficient buffer management for high-speed operations
9
+ - Pattern scanning for offsets \*
10
+ - Read and write memory of Windows processes
11
+
12
+ \* — Feature temporarily disabled
13
+
14
+ ## Requirements
15
+
16
+ - **Bun** (uses `bun:ffi`)
17
+ - **Windows 10/11** (uses `kernel32.dll`)
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ bun add bun-memory
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ See [example/trigger-bot.ts](example/trigger-bot.ts) for a real-world example.
28
+
29
+ ### Basic Example
30
+
31
+ ```ts
32
+ import Memory from 'bun-memory';
33
+
34
+ // Attach to process by name…
35
+ const memory = new Memory('notepad.exe');
36
+ // …or PID
37
+ const memory = new Memory(1234);
38
+
39
+ // Access loaded modules
40
+ const modules = memory.modules;
41
+ const mainModule = modules['notepad.exe'];
42
+ console.log(`Base address: 0x${mainModule.modBaseAddr.toString(16)}`);
43
+ console.log(`Size: ${mainModule.modBaseSize} bytes`);
44
+
45
+ // Read a 32-bit integer
46
+ const value = memory.i32(0x12345678n);
47
+
48
+ // Write a float
49
+ memory.f32(0x12345678n, 3.14159);
50
+
51
+ // Clean up
52
+ memory.close();
53
+ ```
54
+
55
+ ### Pattern Scanning
56
+
57
+ ```ts
58
+ const offset = memory.findPattern('aa??bbccdd??ff', mainModule.modBaseAddr, mainModule.modBaseSize);
59
+ const value = memory.bool(offset + 0x1234n);
60
+ memory.close();
61
+ ```
62
+
63
+ ### Efficient Buffer Reads
64
+
65
+ ```ts
66
+ const scratch = Buffer.allocUnsafe(0xf000);
67
+ const view = new BigUint64Array(scratch.buffer, scratch.byteOffset, 0xf000 / 8);
68
+
69
+ while (true) {
70
+ memory.read(myAddress, scratch); // Updates scratch and view, no allocations
71
+ }
72
+ ```
73
+
74
+ ```ts
75
+ const scratch = Buffer.allocUnsafe(0x100);
76
+ memory.read(myAddress, scratch);
77
+ ```
78
+
79
+ ## Notes
80
+
81
+ - Only works with Bun and Windows.
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "url": "git://github.com/obscuritysrl/bun-memory.git"
23
23
  },
24
24
  "type": "module",
25
- "version": "1.1.6",
25
+ "version": "1.1.7",
26
26
  "main": "./index.ts",
27
27
  "keywords": [
28
28
  "bun",