{"_id":"list-open-files","_rev":"3-a10e9105f648b4ac8e1a32dad49256bc","name":"list-open-files","dist-tags":{"latest":"1.1.0"},"versions":{"0.0.1":{"name":"list-open-files","version":"0.0.1","description":"lsof for Node.js but with a modern API","author":{"name":"Gustaf Räntilä"},"license":"MIT","bugs":{"url":"https://github.com/grantila/list-open-files/issues"},"homepage":"https://github.com/grantila/list-open-files#readme","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=6"},"scripts":{"build":"rimraf dist && node_modules/.bin/tsc -p .","jest":"jest --detectOpenHandles","test":"npm run jest -- --coverage","buildtest":"npm run build && npm run jest","buildtestcov":"npm run build && npm run test","coverage":"nyc report --reporter=html","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","prepack":"npm run build && npm run test","travis-deploy-once":"travis-deploy-once","semantic-release":"semantic-release","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/list-open-files.git"},"keywords":["lsof","list","open files","open","files"],"devDependencies":{"@types/jest":"^24.0.13","@types/node":"^12.0.4","commitizen":"^3.1.1","cz-conventional-changelog":"^2.1.0","jest":"^24.8.0","rimraf":"^2.6.3","semantic-release":"^15.13.16","travis-deploy-once":"^5.0.11","ts-jest":"^24.0.2","ts-node":"^8.1.0","typescript":"^3.4.5"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"61ed29652874f37d20f2d6c29c4247dc7d3941ac","_id":"list-open-files@0.0.1","_nodeVersion":"12.2.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-rf+T5z3NzwsZ6WV1ZiLMqFI1KPwmoo2MR2ogAaS9XlgcEW0mOATpFZNUX8lB5QnJTmq94ulyxWUAYPtnuKvsgw==","shasum":"108c4f282d509c8253a85ffce140f7e28a14138e","tarball":"https://registry.npmjs.org/list-open-files/-/list-open-files-0.0.1.tgz","fileCount":27,"unpackedSize":96680,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdE7J2CRA9TVsSAnZWagAAkZUP+wcDxGtI/SIcwEuuK0/i\nABjm7JKrdMQsgMTOkq+mRizsVOTk9+7NMMwHgA6r26qE+UJ+cDvggdBSB0uI\nByd4ZuJIz0i3OqeZR8nO//blFFqYiDADgoCaYJrvOIFKxuGtcC9TYD7yqL/J\nUtukLq46IIGUNGxbtrmO9JAevFzr8tgCHHYacsUEJpG7hSSUlnD/ozMQudSa\nnltdqkXzJJ2inMtogFGugZ56VWMYbgpv2V+Vt2AnMdXTt45bExWIxTFAuIcN\nkl61A66CqMYzezndsd0lLD3gMZ5uSh3Dyb5Sge60Bs/kCjeRK7b6lFHpdRQY\nbvJmTyNzR1vUm18Vlh/6YwPFK9h/ALWrmoR7aHUTbfwQCt44KPsalcmi3LTx\nQMepYHxcQe+1gTjfdHcAjAwswE2VzItWNr77Pte5vRjAy71aMRbuVopCKtrF\n48GU5bLrdk86AfNWftywfsK6vMq+1FthiQA2nUVKuTZO46E/9d95L2GwlLSo\n18cfwtww3GSd1vt7RKX1EiBcI+k1DpDW4mpjtVbeHOwzCmzM8S8eGtbFZ4ay\n8e6uIoLqdTRr2EsvkgHFj+3JmD7X+pYCeUd4bSxBX/Pe+nzl+dS6wr0nXAhA\n032Zab9nv1pzA1BC6gaYe9+KKUKDY8rLkvacB99wg/2hlmGvuT6f6UayDqlf\nIBhc\r\n=UjTr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQADCflipLTU57ucEEXIifuUfmq+myElhlESVuEb2tHAIgb49Gn2QVuXbSHu4F8y47RQK98qjTT9jMyfu+u4rLIic="}]},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/list-open-files_0.0.1_1561571957673_0.948508726316114"},"_hasShrinkwrap":false},"1.0.0":{"name":"list-open-files","version":"1.0.0","description":"lsof for Node.js but with a modern API","author":{"name":"Gustaf Räntilä"},"license":"MIT","bugs":{"url":"https://github.com/grantila/list-open-files/issues"},"homepage":"https://github.com/grantila/list-open-files#readme","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=8"},"scripts":{"build":"rimraf dist && node_modules/.bin/tsc -p .","jest":"jest","test":"npm run jest -- --coverage","buildtest":"npm run build && npm run jest","buildtestcov":"npm run build && npm run test","coverage":"nyc report --reporter=html","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","prepack":"npm run build && npm run test","travis-deploy-once":"travis-deploy-once","semantic-release":"semantic-release","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/list-open-files.git"},"keywords":["lsof","list","open files","open","files"],"devDependencies":{"@types/jest":"^24.0.13","@types/node":"^12.0.4","commitizen":"^3.1.1","cz-conventional-changelog":"^2.1.0","jest":"^24.8.0","rimraf":"^2.6.3","semantic-release":"^15.13.18","travis-deploy-once":"^5.0.11","ts-jest":"^24.0.2","ts-node":"^8.1.0","typescript":"^3.4.5"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"19cd756bb0733cf589dc73c396b1abf8a046117b","_id":"list-open-files@1.0.0","_nodeVersion":"12.4.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-uQ2bEW1cKE5GA8ZlO8XNDNlwkgZRw1QgDJUq6yh9n4tcqwhDe1JCa7jKyY/7LH6XCpHP3Slzp0tlXFXIg6UPSQ==","shasum":"b783b5f1087fe1f954f17d7c0b8b35b349f77bc1","tarball":"https://registry.npmjs.org/list-open-files/-/list-open-files-1.0.0.tgz","fileCount":27,"unpackedSize":96660,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdE8ChCRA9TVsSAnZWagAASNUP/2oWpMnyBZ5KX/jyIX+8\n4Qwux00tmD3RQDyPBuiu2pG2jcZWyoIl+O4cAAw1bS9uEgRYl04yKnJi2N+E\nAyr+3Vzko5MxMzAPOdzM3hOHhPQ8rr2taEuwNsxP6Ytwo4vFfI28N+l4WB8D\nxQGY6jeAxuxw/CNnIU2zhSM7T23gbemlFI7LlQYUv0yiOcBzi2+EZaNsldvc\nUf4wElHgmNlPjw2F8yQYAbQzxFcYiS8Dxg6abnpFSwvJXMN9vxQtaSkRIbX3\ntqVsWi2a+6u24VxlGKSON/SXCYvLCn+I2fiCeNzU3lxWnzLQOES6HmdyGBsR\n2pJs0HnJywYYG3mCMP89DZ2BrP5137UpaCBVAMdlQpuG+X/tXIFsqQXpm/54\nCN4dJiDUPme3ppSHhgUATL/dyCk9ja3f1+KxxcYFNrU70+1/WGjv7Lr9s327\ndxPgThZQCTLoS+OjX2xviDxjsZfEyNR15f1SeoAwPw4GXw8x7GHIxt2Q0KAK\no5f1vVYElKpSSOIfVNeca3v4lytQgMFg7ntuD3sbXzzsltP/zW2VwQMt2Mt0\nGI3BwqU2jQEn8SkpKf+9SUwZasmdZHmK7J0R8f9mygr/iPhU0y8I6DVsDywv\nMx4oG2bT8AwkZUK+2QrPik0By1gYtvsTvcDhltoRnzolYpcjTmsRenRInjqz\n2EXA\r\n=0XFv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFXNdif4DhsmooQJLSRrHfn9iO35/ZB1ztX0X8FjbZzgIgeMwaJ7zFXrkHvmnhSnWsBbK4o3cn5XtM1YiMWNEB3AI="}]},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/list-open-files_1.0.0_1561575584762_0.709654599904304"},"_hasShrinkwrap":false},"1.1.0":{"name":"list-open-files","version":"1.1.0","description":"lsof for Node.js but with a modern API","author":{"name":"Gustaf Räntilä"},"license":"MIT","bugs":{"url":"https://github.com/grantila/list-open-files/issues"},"homepage":"https://github.com/grantila/list-open-files#readme","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=8"},"scripts":{"build":"rimraf dist && node_modules/.bin/tsc -p .","jest":"jest","test":"npm run jest -- --coverage","buildtest":"npm run build && npm run jest","buildtestcov":"npm run build && npm run test","coveralls":"cat coverage/lcov.info | node_modules/.bin/coveralls","prepack":"npm run build && npm run test","travis-deploy-once":"travis-deploy-once","semantic-release":"semantic-release","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/list-open-files.git"},"keywords":["lsof","list","open files","open","files"],"devDependencies":{"@types/jest":"^24.0.13","@types/node":"^12.0.4","commitizen":"^3.1.1","cz-conventional-changelog":"^2.1.0","jest":"^24.8.0","rimraf":"^2.6.3","semantic-release":"^15.13.18","travis-deploy-once":"^5.0.11","ts-jest":"^24.0.2","ts-node":"^8.1.0","typescript":"^3.4.5"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"fe4cff787701678dd60e8f0476b021573347b814","_id":"list-open-files@1.1.0","_nodeVersion":"12.6.0","_npmVersion":"6.10.0","dist":{"integrity":"sha512-HdpgU3D+hBHWclA5J6Uyi3S8VhF+k3+qXur8gOmEuiBltCtUyr0z+HnJb63kNf1kJHFiZ00TWfRF/4m95wfblQ==","shasum":"df824dbdb145444cc774b0c3e7200c65c5392da6","tarball":"https://registry.npmjs.org/list-open-files/-/list-open-files-1.1.0.tgz","fileCount":27,"unpackedSize":96643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdHbL1CRA9TVsSAnZWagAA484P/0AmNCi9Q8Zg/Fyk+5b4\nYQG4Tbvnh4eKUIGZKj288X+EOHQHEKrrN134WdkpRb/BSqhNJg8yl6xq71Jt\ndYLHuvVzfi84TnoFPZlDbDKffIeQthcHOVYaHPnLjgWqHINb/UAYQRPmJSEN\nlJkrkWjMzJHB4R9xhBNPOTeYiZ7j3agQf8PP5s1jV+BaOdazV1l5N0hT0St0\nliYMjrhUFqsA0NvnNUhmJ5i6ceSGOGlWxUkZzd4mMiZ/It3VELs1KJRaZ/5F\nAWVQivxVk3Dy27I6AC0ugRbfognD08Bs8UR5jPU+sCD9fqDKKzBo0YnS3RRN\nRjKsS6qBJSJeHHjQTtxqMeKh4dnpIUPcKweVw9qaQpvXqJSpipJbq+wFtx86\nctD5R94r2Y6Wiybk7qQv11AtEfFX1GFqJSOlrZVsJqebKtLnhP0rcQFB5hwK\nraFlnX0fxQLJtewPf+dmh+beP3uQxdUOmFC4WXeshDFzFd8YxMVLktKwImRj\nJ3IjYVGakxsChs/2wVI4WgRtCuz4r+3bsZHunkcFi9ymy/HIlhXfb8AlJn5r\nXpUTsO187WQ7lBaZuCdMAQbBd5qSC/1zZBH5gmG6po+t+xmZ0g1WZnWUu1iz\nH3fdhBJsh6zSenEcqhj8Kr+pkRkqZZNA08RSo5XBA2JzkxtULly1qrtdqlLR\nRSPU\r\n=7z70\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDvOZc/yLMW/uOPbLEVQehIRlPMsy5UE4TbwbWM9izE1QIhANAPTuWtZZO/dwYxYiEUP6t6jBfb4sIzc6hhAs0FCyT4"}]},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/list-open-files_1.1.0_1562227444604_0.7991308279764266"},"_hasShrinkwrap":false}},"time":{"created":"2019-06-26T17:59:17.673Z","0.0.1":"2019-06-26T17:59:18.001Z","modified":"2022-05-08T04:11:18.292Z","1.0.0":"2019-06-26T18:59:44.950Z","1.1.0":"2019-07-04T08:04:04.707Z"},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"description":"lsof for Node.js but with a modern API","homepage":"https://github.com/grantila/list-open-files#readme","keywords":["lsof","list","open files","open","files"],"repository":{"type":"git","url":"git+https://github.com/grantila/list-open-files.git"},"author":{"name":"Gustaf Räntilä"},"bugs":{"url":"https://github.com/grantila/list-open-files/issues"},"license":"MIT","readme":"[![npm version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![coverage status][coverage-image]][coverage-url]\n[![Greenkeeper badge](https://badges.greenkeeper.io/grantila/list-open-files.svg)](https://greenkeeper.io/)\n[![Language grade: JavaScript][lgtm-image]][lgtm-url]\n\n\n# list-open-files\n\n[`lsof`](http://man7.org/linux/man-pages/man8/lsof.8.html) for Node.js, with an asynchronous Promise-based API and JSON-serializable self-explained objects.\n\n# API\n\n```ts\nimport { lsof, Options } from \"list-open-files\"\n\nlsof( opts?: Options ): Promise< Array< ProcessInfo > >;\n```\n\nThe optional options object is defined as:\n\n```ts\ninterface Options\n{\n\tpids?: Array< number >;\n\tconcurrency?: number;\n}\n```\n\nIf no `pids` are provided, the current process will be queried.\n\nIf `concurrency` is specified, it will be used to call the underlying `lsof` command with that concurrency (at most). The default is built-in and environment specific - it depends on the underlying hardware and is optimized, and therefore generally a good choice. To affect the host computer the least, specify `1`, although this will have a very small effect.\n\nThe return value is eventually an array (even if only one pid is queried) of zero or more `ProcessInfo` objects each on the form:\n\n```ts\ninterface ProcessInfo\n{\n\tprocess: Process;\n\tfiles: Array< File | FileDescriptorIP | UnknownFile >;\n\ttexts: Array< InternalFile >;\n}\n```\n\n## Example\n\n### All open files in a primitive Node.js application\n\n```ts\nimport { lsof } from \"list-open-files\"\n\nlsof( ).then( result => console.log( result ) );\n```\n\nWhen run on MacOS as `node . > output.txt`, will write a file called `output.txt` (note fd 1)\n\n<details><summary>View `output.txt`</summary><p>\n\n```json\n[\n\t{\n\t\t\"process\": {\n\t\t\t\"pid\": 26549,\n\t\t\t\"ppid\": 13150,\n\t\t\t\"gpid\": 26549,\n\t\t\t\"user\": \"501\",\n\t\t\t\"name\": \"node\",\n\t\t\t\"cwd\": {\n\t\t\t\t\"fd\": \"cwd\",\n\t\t\t\t\"type\": \"DIR\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 512,\n\t\t\t\t\"iNode\": \"10101630\",\n\t\t\t\t\"linkCount\": 16,\n\t\t\t\t\"name\": \"/tmp/list-open-files\"\n\t\t\t}\n\t\t},\n\t\t\"texts\": [\n\t\t\t{\n\t\t\t\t\"fd\": \"txt\",\n\t\t\t\t\"type\": \"REG\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 40180432,\n\t\t\t\t\"iNode\": \"9886022\",\n\t\t\t\t\"linkCount\": 1,\n\t\t\t\t\"name\": \"/tmp/node/bin/node\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": \"txt\",\n\t\t\t\t\"type\": \"REG\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 973824,\n\t\t\t\t\"iNode\": \"9995914\",\n\t\t\t\t\"linkCount\": 1,\n\t\t\t\t\"name\": \"/usr/lib/dyld\"\n\t\t\t}\n\t\t],\n\t\t\"files\": [\n\t\t\t{\n\t\t\t\t\"fd\": 0,\n\t\t\t\t\"type\": \"CHR\",\n\t\t\t\t\"access\": \"u\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"iNode\": \"689\",\n\t\t\t\t\"linkCount\": 1,\n\t\t\t\t\"name\": \"/dev/ttys026\",\n\t\t\t\t\"majorMinorDeviceNumber\": 1285824432,\n\t\t\t\t\"flags\": \"0x3;0x3\",\n\t\t\t\t\"offset\": 4568009\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 1,\n\t\t\t\t\"type\": \"REG\",\n\t\t\t\t\"access\": \"w\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 0,\n\t\t\t\t\"iNode\": \"10603551\",\n\t\t\t\t\"linkCount\": 1,\n\t\t\t\t\"name\": \"/tmp/list-open-files/output.txt\",\n\t\t\t\t\"majorMinorDeviceNumber\": 16777220,\n\t\t\t\t\"flags\": \"0x2;0x2\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 2,\n\t\t\t\t\"type\": \"CHR\",\n\t\t\t\t\"access\": \"u\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"iNode\": \"689\",\n\t\t\t\t\"linkCount\": 1,\n\t\t\t\t\"name\": \"/dev/ttys026\",\n\t\t\t\t\"majorMinorDeviceNumber\": 1285824432,\n\t\t\t\t\"flags\": \"0x3;0x3\",\n\t\t\t\t\"offset\": 4568009\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 3,\n\t\t\t\t\"type\": \"KQUEUE\",\n\t\t\t\t\"access\": \"u\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"name\": \"count=0, state=0\",\n\t\t\t\t\"flags\": \"0x3;0x2\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 4,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c319193139d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 5,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c319192f4dd\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 6,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c319193019d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 7,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c319193025d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 8,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c319193121d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 9,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c31919312dd\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 10,\n\t\t\t\t\"type\": \"KQUEUE\",\n\t\t\t\t\"access\": \"u\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"name\": \"count=0, state=0xa\",\n\t\t\t\t\"flags\": \"0x3;0x2\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 11,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c319192f59d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 12,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c319193031d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 13,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c3189f2939d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 14,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c319193145d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 15,\n\t\t\t\t\"type\": \"KQUEUE\",\n\t\t\t\t\"access\": \"u\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"name\": \"count=0, state=0xa\",\n\t\t\t\t\"flags\": \"0x3;0x2\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 16,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c3189f2945d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 17,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c3189f2975d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 18,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c3189f26c9d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 19,\n\t\t\t\t\"type\": \"PIPE\",\n\t\t\t\t\"access\": \" \",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"size\": 16384,\n\t\t\t\t\"name\": \"->0xa5332c3189f2735d\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 20,\n\t\t\t\t\"type\": \"CHR\",\n\t\t\t\t\"access\": \"r\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"iNode\": \"311\",\n\t\t\t\t\"linkCount\": 1,\n\t\t\t\t\"name\": \"/dev/null\",\n\t\t\t\t\"majorMinorDeviceNumber\": 1285824432,\n\t\t\t\t\"flags\": \"0x1;0x2\",\n\t\t\t\t\"offset\": 0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 21,\n\t\t\t\t\"type\": \"unix\",\n\t\t\t\t\"access\": \"u\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"name\": \"->0xa5332c31a4d693a5\",\n\t\t\t\t\"flags\": \"0x7;0x2\",\n\t\t\t\t\"offset\": 0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 23,\n\t\t\t\t\"type\": \"unix\",\n\t\t\t\t\"access\": \"u\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"name\": \"->0xa5332c31a4d6b21d\",\n\t\t\t\t\"flags\": \"0x7;0x2\",\n\t\t\t\t\"offset\": 0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"fd\": 25,\n\t\t\t\t\"type\": \"unix\",\n\t\t\t\t\"access\": \"u\",\n\t\t\t\t\"lock\": \" \",\n\t\t\t\t\"name\": \"->0xa5332c31a4d6b6cd\",\n\t\t\t\t\"flags\": \"0x7;0x2\",\n\t\t\t\t\"offset\": 0\n\t\t\t}\n\t\t]\n\t}\n]\n```\n\n</p></details>\n\n### Listening and client connections\n\nThe following application creates a listening port (which will happen to listen on IPv6, which also supports IPv4). It then connects to it, which results on two more sockets, one for the outgoing client socket, one for the incoming socket since the application connects to itself.\n\n```ts\nimport { lsof } from \"list-open-files\"\nimport { createServer, connect, AddressInfo } from 'net'\n\nasync function testIP( ): Promise< void >\n{\n\tconst [ result1 ] = await lsof( ); // Files before server is listening\n\n\tconst server = createServer( );\n\n\tawait new Promise( ( resolve, reject ) =>\n\t{\n\t\tserver.listen( );\n\t\tserver.on( 'listening', resolve );\n\t\tserver.on( 'error', reject );\n\t} );\n\n\tconst { port } = < AddressInfo >server.address( )\n\n\tconst [ result2 ] = await lsof( ); // Files after the server is listening\n\n\tawait new Promise( ( resolve, reject ) =>\n\t{\n\t\tconst client = connect( port, 'localhost' );\n\t\tclient.on( 'connect', resolve );\n\t\tclient.on( 'error', reject );\n\t} );\n\n\tconst [ result3 ] = await lsof( ); // Files after client connection is established\n\n\tconsole.log( result1.files.filter( file => file.type === 'IP' ) );\n\tconsole.log( result2.files.filter( file => file.type === 'IP' ) );\n\tconsole.log( result3.files.filter( file => file.type === 'IP' ) );\n}\n\ntestIP( )\n.catch( err => console.error( err ) );\n```\n\nThis will output:\n\n```js\n[]\n[\n\t{\n\t\tfd: 22,\n\t\ttype: 'IP',\n\t\taccess: 'u',\n\t\tlock: ' ',\n\t\tsize: undefined,\n\t\tiNode: undefined,\n\t\tlinkCount: undefined,\n\t\tname: '*:50710',\n\t\tprotocol: 'TCP',\n\t\tversion: 6,\n\t\tfrom: undefined,\n\t\tto: { address: '*', port: 50710 }\n\t}\n]\n[\n\t{\n\t\tfd: 22,\n\t\ttype: 'IP',\n\t\taccess: 'u',\n\t\tlock: ' ',\n\t\tsize: undefined,\n\t\tiNode: undefined,\n\t\tlinkCount: undefined,\n\t\tname: '*:50710',\n\t\tprotocol: 'TCP',\n\t\tversion: 6,\n\t\tfrom: undefined,\n\t\tto: { address: '*', port: 50710 }\n\t},\n\t{\n\t\tfd: 26,\n\t\ttype: 'IP',\n\t\taccess: 'u',\n\t\tlock: ' ',\n\t\tsize: undefined,\n\t\tiNode: undefined,\n\t\tlinkCount: undefined,\n\t\tname: '127.0.0.1:50711->127.0.0.1:50710',\n\t\tprotocol: 'TCP',\n\t\tversion: 4,\n\t\tfrom: { address: '127.0.0.1', port: 50711 },\n\t\tto: { address: '127.0.0.1', port: 50710 }\n\t},\n\t{\n\t\tfd: 28,\n\t\ttype: 'IP',\n\t\taccess: 'u',\n\t\tlock: ' ',\n\t\tsize: undefined,\n\t\tiNode: undefined,\n\t\tlinkCount: undefined,\n\t\tname: '127.0.0.1:50710->127.0.0.1:50711',\n\t\tprotocol: 'TCP',\n\t\tversion: 6,\n\t\tfrom: { address: '127.0.0.1', port: 50710 },\n\t\tto: { address: '127.0.0.1', port: 50711 }\n\t}\n]\n```\n\n\n## Reference\n\n### ProcessInfo\n\n```ts\ninterface ProcessInfo\n{\n\tprocess: Process;\n\tfiles: Array< File | FileDescriptorIP | UnknownFile >;\n\ttexts: Array< InternalFile >;\n}\n```\n\n### Process\n\n```ts\ninterface Process\n{\n\tpid: number;\n\tgpid?: number;\n\tppid?: number;\n\ttid?: number;\n\tuser?: string;\n\tname?: string;\n\tcwd?: InternalFile;\n}\n```\n\n### InternalFile\n\n```ts\ninterface InternalFile\n{\n\tfd: string; // Note `string` - it's not a traditional file descriptor\n\ttype: Type;\n\taccess: Access | void;\n\tlock: Lock | void;\n\tsize: Size | void;\n\tiNode: INode | void;\n\tlinkCount: LinkCount | void;\n\tname: string | void;\n}\n```\n\n### File\n\n```ts\ninterface File\n{\n\t// From base type\n\tfd: number;\n\ttype: Type;\n\taccess: Access | void;\n\tlock: Lock | void;\n\tsize: Size | void;\n\tiNode: INode | void;\n\tlinkCount: LinkCount | void;\n\tname: string | void;\n\n\t// Specific to File\n\tmajorMinorDeviceNumber: MajorMinorDeviceNumber | void;\n\tflags: RawFileFlags | void;\n\toffset: Offset | void;\n}\n```\n\n### UnknownFile\n\n```ts\ninterface UnknownFile\n{\n\t// From base type\n\tfd: number;\n\ttype: Type;\n\taccess: Access | void;\n\tlock: Lock | void;\n\tsize: Size | void;\n\tiNode: INode | void;\n\tlinkCount: LinkCount | void;\n\tname: string | void;\n\n\t// Specific to UnknownFile\n\tcmd: string | undefined;\n\tfileStructureShareCount: FileStructureShareCount | undefined; // FCT\n\tcharCode: CharacterCode | undefined;\n\tmajorMinorDeviceNumber: MajorMinorDeviceNumber | undefined;\n\tfileStructureAddress: FileStructureAddress | undefined; // FILE-ADDR\n\tflags: RawFileFlags | undefined; // FILE-FLAG\n\tloginName: LoginName | undefined;\n\tnode: Node | undefined; // NODE\n\toffset: Offset | undefined;\n\tprotocolName: ProtocolName | undefined;\n\tdeviceNumber: DeviceNumber | undefined // DEVICE\n\tstreamIdentification: StreamIdentification | undefined;\n\ttcpTpiInformation: TcpTpiInformation | undefined;\n\tsolarisZoneName: SolarisZoneName | undefined;\n\tseLinuxSecurityContext: SELinuxSecurityContext | undefined;\n\t1: any | undefined;\n\t2: any | undefined;\n\t3: any | undefined;\n\t4: any | undefined;\n\t5: any | undefined;\n\t6: any | undefined;\n\t7: any | undefined;\n\t8: any | undefined;\n\t9: any | undefined;\n}\n```\n\n### FileDescriptorIP\n\n```ts\ninterface FileDescriptorIP\n{\n\t// From base type\n\tfd: number;\n\ttype: 'IP';\n\taccess: Access | void;\n\tlock: Lock | void;\n\tsize: Size | void;\n\tiNode: INode | void;\n\tlinkCount: LinkCount | void;\n\tname: string | void;\n\n\t// Specific to FileDescriptorIP\n\tprotocol: 'TCP' | 'UDP';\n\tversion: 4 | 6;\n\tfrom: IP | void;\n\tto: IP | void;\n}\n```\n\n### IP\n\n```ts\nexport interface IP\n{\n\taddress: string;\n\tport: number;\n}\n```\n\n\n[npm-image]: https://img.shields.io/npm/v/list-open-files.svg\n[npm-url]: https://npmjs.org/package/list-open-files\n[travis-image]: https://img.shields.io/travis/grantila/list-open-files/master.svg\n[travis-url]: https://travis-ci.org/grantila/list-open-files\n[coverage-image]: https://coveralls.io/repos/github/grantila/list-open-files/badge.svg?branch=master\n[coverage-url]: https://coveralls.io/github/grantila/list-open-files?branch=master\n[lgtm-image]: https://img.shields.io/lgtm/grade/javascript/g/grantila/list-open-files.svg?logo=lgtm&logoWidth=18\n[lgtm-url]: https://lgtm.com/projects/g/grantila/list-open-files/context:javascript\n","readmeFilename":"README.md"}