native-process-working-directory

Gets another process' working directory, natively, without parsing lsof output or whatnot.

Usage no npm install needed!

<script type="module">
  import nativeProcessWorkingDirectory from 'https://cdn.skypack.dev/native-process-working-directory';
</script>

README

native-process-working-directory

Node CI

Gets another process' working directory, natively, without parsing lsof output or whatnot.

export function getWorkingDirectoryFromPID (pid: number): string|null

// Windows only
export function getWorkingDirectoryFromHandle (handle: number): string|null

Note: getWorkingDirectoryFromPID() on Windows might require administrator privileges, use getWorkingDirectoryFromHandle() if you own the process.