Skip to content

Commit f1a9131

Browse files
committed
Added memory support
1 parent a3b2737 commit f1a9131

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const lupSystem = require('lup-system');
1515
lupSystem.getCpuInfo().then(cpuInfo => console.log("CPU Info: " + cpuInfo));
1616
lupSystem.getDrives().then(drives => console.log("Drives: " + drives)); // Array of drive objects
1717
lupSystem.getGPUs().then(gpus => console.log("GPU Info: " + gpus));
18+
lupSystem.getMemoryInfo().then(memoryInfo => console.log("Memory Info: " + memoryInfo));
1819
lupSystem.getNetworkInterfaces().then(interfaces => console.log("Network Interfaces: " + interfaces));
1920
lupSystem.getOSInfo().then(osInfo => console.log("OS Info: " + osInfo));
2021
lupSystem.getTemperatures().then(temps => console.log("Temperatures: " + temps));
@@ -28,6 +29,7 @@ import lupSystem from 'lup-system';
2829
console.log("CPU Info: ", await lupSystem.getCpuInfo());
2930
console.log("Drives: ", await lupSystem.getDrives()); // Array of drive objects
3031
console.log("GPU Info: ", await lupSystem.getGPUs());
32+
console.log("Memory Info: ", await lupSystem.getMemoryInfo());
3133
console.log("Network Interfaces: ", await lupSystem.getNetworkInterfaces());
3234
console.log("OS Info: ", await lupSystem.getOSInfo());
3335
console.log("Temperatures: ", await lupSystem.getTemperatures());
@@ -104,6 +106,41 @@ GPU Info: [
104106
}
105107
}
106108
]
109+
Memory Info: {
110+
size: 34249633792,
111+
utilization: {
112+
used: 22930456576,
113+
free: 11319177216,
114+
percentage: 0.669509540313861
115+
},
116+
devices: [
117+
{
118+
manufacturer: 'Kingston',
119+
model: 'KF3200C16D4/16GX',
120+
size: 17179869184,
121+
busWidth: 64,
122+
maxClockSpeed: 2400,
123+
clockSpeed: 2400,
124+
voltage: 1.2,
125+
type: 'DDR4',
126+
transfersPerClockCycle: 2,
127+
bandwidth: 38400000000
128+
},
129+
{
130+
manufacturer: 'Kingston',
131+
model: 'KF3200C16D4/16GX',
132+
size: 17179869184,
133+
busWidth: 64,
134+
maxClockSpeed: 2400,
135+
clockSpeed: 2400,
136+
voltage: 1.2,
137+
type: 'DDR4',
138+
transfersPerClockCycle: 2,
139+
bandwidth: 38400000000
140+
}
141+
],
142+
bandwidth: 76800000000
143+
}
107144
Network Interfaces: [
108145
{
109146
name: 'Loopback Pseudo-Interface 1',

src/__tests__/Memory.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getMemory } from '../memory';
1+
import { getMemoryInfo } from '../memory';
22

3-
test('getMemory', async () => {
4-
const memory = await getMemory();
3+
test('getMemoryInfo', async () => {
4+
const memory = await getMemoryInfo();
55
console.log(memory); // TODO REMOVE
66
});

src/memory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export type Memory = {
7373
*
7474
* @returns Memory information.
7575
*/
76-
export async function getMemory(): Promise<Memory> {
76+
export async function getMemoryInfo(): Promise<Memory> {
7777
const memoryInfo: Memory = {
7878
size: os.totalmem(),
7979
utilization: {

0 commit comments

Comments
 (0)