mem-usage-ts
v0.1.4
Published
A cross-platform library for getting process names, ids, and memory usage.
Maintainers
Readme
mem-usage-ts
A cross-platform library for retrieving memory usage information of all processes on the current system. It provides a unified interface to access memory usage data regardless of the underlying operating system.
Install
npm i -g mem-usage-tsUsage
import { getMemoryUsage } from 'mem-usage-ts';
const memoryUsage = getMemoryUsage();
console.log(memoryUsage);Returns an array of objects below
interface MemoryUsage {
processName: string;
pid: number;
memory: number; // Physical/resident memory in bytes
/**
* `null` when not available on this platform. On Windows, this is the "private working set" which matches Task Manager's "内存" column (private resident memory). On other platforms, this may be unavailable or may require elevated permissions, so it's optional.
*/
privateMemory: number | null;
/**
* `null` when not available on this platform. Virtual memory size in bytes. May be unavailable on some platforms or require elevated permissions.
*/
virtualMemory: number | null;
}License
MIT License
