{"id":19478866,"url":"https://github.com/xan105/node-win-tasklist","last_synced_at":"2025-02-25T16:44:26.322Z","repository":{"id":49205326,"uuid":"174083045","full_name":"xan105/node-win-tasklist","owner":"xan105","description":"Wrapper for the Windows tasklist command. Non-English locale friendly as much as possible.","archived":false,"fork":false,"pushed_at":"2023-07-19T03:01:35.000Z","size":92,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T05:17:10.627Z","etag":null,"topics":["nodejs","pid","process","task","tasklist","windows"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xan105.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"xan105","custom":"https://www.paypal.me/xan105"}},"created_at":"2019-03-06T06:11:03.000Z","updated_at":"2023-04-18T04:49:25.000Z","dependencies_parsed_at":"2024-11-10T20:03:26.155Z","dependency_job_id":null,"html_url":"https://github.com/xan105/node-win-tasklist","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"2f91b376dc3fae00a832cd704882c1dac166a3b6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-win-tasklist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-win-tasklist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-win-tasklist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xan105%2Fnode-win-tasklist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xan105","download_url":"https://codeload.github.com/xan105/node-win-tasklist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240709753,"owners_count":19845039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","pid","process","task","tasklist","windows"],"created_at":"2024-11-10T19:51:46.257Z","updated_at":"2025-02-25T16:44:26.287Z","avatar_url":"https://github.com/xan105.png","language":"JavaScript","readme":"About\n=====\n\nWrapper for the Windows tasklist command.\n\n#### Note about locale:\n\nMost Windows commands change their output based on system's locale, which can be sometimes difficult when you are trying to parse the output of a non-English system.\nThis module tries to be system-locale-independent as much as possible in order to be able to parse the tasklist output.\nUnfortunately some returned properties will remain locale-dependent.\n\nExample\n=======\n\nGet a specific process information:\n\n```js\nimport { getProcessInfo } from \"win-tasklist\";\n\nconsole.log( await getProcessInfo(\"explorer.exe\",{verbose: true}) );\n/*\n  [{ process: 'explorer.exe',\n      pid: 6960,\n      sessionType: 'console',\n      sessionNumber: 1,\n      memUsage: 169783296,\n      state: 'running',\n      user: 'skynet\\\\xan',\n      cpuTime: '0:02:15',\n      windowTitle: null }]  \n*/\n\n//By PID and fetch additional info via WMI (args and dir of origin)\n\nconsole.log( await getProcessInfo(15640,{verbose: true, extended: true}) );\n/*\n  { process: 'firefox.exe',\n    pid: 15640,\n    sessionType: 'console',\n    sessionNumber: 1,\n    memUsage: 80269312,\n    state: 'running',\n    user: 'SKYNET\\\\Xan',\n    cpuTime: '0:00:00',\n    windowTitle: 'OleMainThreadWndName',\n    args: '-contentproc -isForBrowser -prefsHandle 2688 ...',\n    origin: 'C:\\\\Program Files\\\\Mozilla Firefox'}  \n*/\n```\n\nIs process running ? \n\n```js\nimport { isProcessRunning } from \"win-tasklist\";\n\nconsole.log( await isProcessRunning(\"firefox.exe\") );\n//true or false\n```\n\nList them all:\n\n```js\nimport tasklist from \"win-tasklist\";\n\nconsole.log( await tasklist() );\n/*\n  [ { process: 'system idle process',\n      pid: 0,\n      sessionType: 'services',\n      sessionNumber: 0,\n      memUsage: 8192 },\n    { process: 'system',\n      pid: 4,\n      sessionType: 'services',\n      sessionNumber: 0,\n      memUsage: 2580480 }, \n      ... 100 more items ]\n*/\n```\n\nInstallation\n============\n\n```\nnpm install win-tasklist\n```\n\nAPI\n===\n\n⚠️ This module is only available as an ECMAScript module (ESM) starting with version 2.0.0.\u003cbr /\u003e\nPrevious version(s) are CommonJS (CJS) with an ESM wrapper.\n\n## Default export\n\n#### `(option?: obj): Promise\u003cobj[]\u003e`\n\nWrapper to the `tasklist` command.\u003cbr /\u003e\nReturns an [Array] of object.\n\n\u003cdetails\u003e\n\u003csummary\u003e⚙️ Options\u003c/summary\u003e\n\n- verbose (default: false)\u003cbr /\u003e\n      if false will return the following properties : `process, pid, sessionType, sessionNumber, memUsage (bytes)`.\u003cbr /\u003e\n      if true will additionally return the following properties : `state, user, cpuTime, windowTitle`.\u003cbr /\u003e\n      \u003cbr /\u003e\n      ⚠️ Keep in mind using the verbose option might impact performance.\n    \n- remote (default: null)\u003cbr /\u003e\n      Name or IP address of a remote computer.\u003cbr /\u003e\n      Must be used with user and password options below.\n    \n- user (default: null)\u003cbr /\u003e\n      Username or Domain\\Username.\n    \n- password (default: null)\u003cbr /\u003e\n      User's password.\n \n- uwpOnly (default: false)\u003cbr /\u003e\n      List only Windows Store Apps (UWP).\u003cbr /\u003e\n      ⚠️ NB: With this option to true and verbose to false; tasklist only returns `process, pid, memUsage (bytes) and AUMID`.\n      \n- filter (default: [])\u003cbr /\u003e\n    \n     Array of string. Each string being a filter.\u003cbr /\u003e\n     \n     eg filter for listing only running processes :\n     `[\"STATUS eq RUNNING\"]`\n\n     \u003ctable\u003e\n        \u003cthead\u003e\n        \u003ctr\u003e\n        \u003cth\u003eFilter Name\u003c/th\u003e\n        \u003cth\u003eValid Operators\u003c/th\u003e\n        \u003cth\u003eValid Values\u003c/th\u003e\n        \u003c/tr\u003e\n        \u003c/thead\u003e\n        \u003ctbody\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eSTATUS\u003c/td\u003e\n        \u003ctd\u003eeq, ne\u003c/td\u003e\n        \u003ctd\u003eRUNNING\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eIMAGENAME\u003c/td\u003e\n        \u003ctd\u003eeq, ne\u003c/td\u003e\n        \u003ctd\u003eImage name\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003ePID\u003c/td\u003e\n        \u003ctd\u003eeq, ne, gt, lt, ge, le\u003c/td\u003e\n        \u003ctd\u003ePID value\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eSESSION\u003c/td\u003e\n        \u003ctd\u003eeq, ne, gt, lt, ge, le\u003c/td\u003e\n        \u003ctd\u003eSession number\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eSESSIONNAME\u003c/td\u003e\n        \u003ctd\u003eeq, ne\u003c/td\u003e\n        \u003ctd\u003eSession name\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eCPUTIME\u003c/td\u003e\n        \u003ctd\u003eeq, ne, gt, lt, ge, le\u003c/td\u003e\n        \u003ctd\u003eCPU time in the format \u003cem\u003eHH\u003c/em\u003e\u003cstrong\u003e:\u003c/strong\u003e\u003cem\u003eMM\u003c/em\u003e\u003cstrong\u003e:\u003c/strong\u003e\u003cem\u003eSS\u003c/em\u003e, where \u003cem\u003eMM\u003c/em\u003e and \u003cem\u003eSS\u003c/em\u003e are between 0 and 59 and \u003cem\u003eHH\u003c/em\u003e is any unsigned number\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eMEMUSAGE\u003c/td\u003e\n        \u003ctd\u003eeq, ne, gt, lt, ge, le\u003c/td\u003e\n        \u003ctd\u003eMemory usage in KB\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eUSERNAME\u003c/td\u003e\n        \u003ctd\u003eeq, ne\u003c/td\u003e\n        \u003ctd\u003eAny valid user name\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eSERVICES\u003c/td\u003e\n        \u003ctd\u003eeq, ne\u003c/td\u003e\n        \u003ctd\u003eService name\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eWINDOWTITLE\u003c/td\u003e\n        \u003ctd\u003eeq, ne\u003c/td\u003e\n        \u003ctd\u003eWindow title\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n        \u003ctd\u003eMODULES\u003c/td\u003e\n        \u003ctd\u003eeq, ne\u003c/td\u003e\n        \u003ctd\u003eDLL name\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003c/tbody\u003e\n    \u003c/table\u003e\n \n💡 More details in the official [tasklist](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/tasklist) doc.\n    \n\u003c/details\u003e\n\n## Named export\n\n#### `getProcessInfo(process: string | number, option?: obj): Promise\u003cobj[] | obj\u003e`\n\n  `process` can either be a PID (number or number as a string) or an imagename (string).\u003cbr /\u003e\n  Same option as default export minus `filter` and with the addition of `extended` (_boolean_).\n  \n  `extended` adds `args` and `origin` (dir) properties from WMI.\u003cbr /\u003e\n  See `getAdditionalInfoFromWMI()` for more details.\n\n  Returns an [Array] of object or a single obj if you are searching by PID (number or number as a string).\u003cbr /\u003e\n\n#### `isProcessRunning(process: string | number, option?: obj): Promise\u003cboolean\u003e`\n\n  `process` can either be a PID (number or number as a string) or an imagename (string).\u003cbr /\u003e\n  Same option as default export minus `filter` and `verbose`.\n  \n  Return true if the specified process is running (*meaning it has the status RUNNING*), false otherwise.\u003cbr /\u003e\n   \n  Equivalent of filter `IMAGENAME/PID eq %process% and STATUS eq RUNNING`.\u003cbr /\u003e\n\n#### `hasProcess(process: string | number, option?: obj): Promise\u003cboolean\u003e`\n\n  `process` can either be a PID (number or number as a string) or an imagename (string).\u003cbr /\u003e\n  Same option as default export minus `filter` and `verbose`.\n  \n  Return true if the specified process is loaded (*meaning it is listed in the tasklist*), false otherwise.\u003cbr /\u003e\n  \n  Equivalent of filter `IMAGENAME/PID eq %process%`.\u003cbr /\u003e\n\n#### `getAdditionalInfoFromWMI(pid: number): Promise\u003cobj\u003e`\n\n  Query WMI for process' commandline and location (dirpath).\u003cbr /\u003e\n  Return an object:\n  \n```js\n  {\n    args: string, //command line\n    origin: string | null //location (dirpath)\n  }\n```\n\n  In case information can not be accessed due to privileges restriction then `origin` will be `null` and `args` will be empty.","funding_links":["https://patreon.com/xan105","https://www.paypal.me/xan105"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxan105%2Fnode-win-tasklist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxan105%2Fnode-win-tasklist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxan105%2Fnode-win-tasklist/lists"}