{"_id":"kernelsu","_rev":"10-209eb5c36c4a3c2cbce62dd5558d905a","name":"kernelsu","dist-tags":{"latest":"3.3.0"},"versions":{"1.0.0":{"name":"kernelsu","version":"1.0.0","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"GPL-3.0-or-later","_id":"kernelsu@1.0.0","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"a2cb5004377f8a01663a19c9982ad9a110c50819","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-1.0.0.tgz","fileCount":2,"integrity":"sha512-lSCt1hv3eaumYi/nyGDMtLthPNOr28gedQ/Btbm2M5XwrQvMKI2/LeI0B7LV8uhq72pCAyIX+fDg6YSOUltjVQ==","signatures":[{"sig":"MEQCIHKfcVOIJBdFsg2M87XrinwjuhbGvyhR+OJBYxsocFKUAiApNhM4NqCAIXMwyi2AvypNWgGGVBlsTCmveUUGsvGV2A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1733},"main":"index.js","gitHead":"811c68cac01d962b87af68f547ed702f95d7b460","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"10.2.4","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"21.5.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_1.0.0_1708606258748_0.7106493042498379","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"kernelsu","version":"1.0.1","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"GPL-3.0-or-later","_id":"kernelsu@1.0.1","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"bd8e53b8b205ef10be23deb6272f0854e96c56bc","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-1.0.1.tgz","fileCount":2,"integrity":"sha512-eHN6kNStboE6k1nTSwNDoljCe3ANouyy1f8nw8l7yqkkclPysWzdAScdzdwGWm+k42QalW2YEFOrWQU4rgH5IA==","signatures":[{"sig":"MEUCIBLJYDoJS0SsKWOkpoUbmnoloFeU6Lojp1gY5dtr3qEFAiEAw96qPggw+r4/oLXerUPjyGsLNuG3SWfjz5UsnpBG9vs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1740},"main":"index.js","gitHead":"811c68cac01d962b87af68f547ed702f95d7b460","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"10.2.4","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"21.5.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_1.0.1_1708610069714_0.055351893092526305","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"kernelsu","version":"1.0.2","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"GPL-3.0-or-later","_id":"kernelsu@1.0.2","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"f952b304b4c1a501bd7cee459425c3b95cbf9d86","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-1.0.2.tgz","fileCount":3,"integrity":"sha512-Y5gAoOxrYJ7yzHwi2wlY8yRaJ/7NPLGIYxRfkz+cEcWrxc1le9UDE0yUVHGZcbIzX6/yDhzK/OXgRg/DRTGQzQ==","signatures":[{"sig":"MEQCIHBNnQzywRJiZKByH01GEz4NavQD3PoXL3hPGnOicXwZAiAPFMThPmm4EoJk2hltAnUieFrGCivT/7k3VEIrcVMDjw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2510},"main":"index.js","gitHead":"b904680f1330b1662e6c966e256ded513be5891a","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"10.2.4","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"21.5.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_1.0.2_1708610977519_0.7403524524319947","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"kernelsu","version":"1.0.4","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"GPL-3.0-or-later","_id":"kernelsu@1.0.4","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"3cbcb507034755ca4263f1b90d03a12e23be0f9a","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-1.0.4.tgz","fileCount":3,"integrity":"sha512-AilEXLUpIQKPpwn+UES704Ls0FldCpcLwX2VUW8qQPmXFdL4fjvL1/MdSC5pOzieO7dQJCSZ7CYI4IWrtvR50Q==","signatures":[{"sig":"MEUCIQCA6O7GG20jLJXgGUS0Jds6GLoyhicd3NwfxZ41yltpxAIgXfRyQ02dkBtcYmRaswbeuwitCFMi+1hFvIRDOxLwCZQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5527},"main":"index.js","gitHead":"77d16ac8960b704025577fe47de04418e7c58179","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"10.2.4","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"21.5.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_1.0.4_1708618798237_0.15612365821010488","host":"s3://npm-registry-packages"}},"1.0.5":{"name":"kernelsu","version":"1.0.5","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"GPL-3.0-or-later","_id":"kernelsu@1.0.5","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"8228288469f38e7f28931e004601e8015373889c","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-1.0.5.tgz","fileCount":3,"integrity":"sha512-n92yAzr9XFWWrsXO3+nSi4E7zboY0JKFCDxy7+OPIPGJopKDDc27Iyy6TE5Jb7PJ808r59P66iCGIFlXZKifnQ==","signatures":[{"sig":"MEQCIEbkFk+QMpdHuSOtaehfYt1IeFxtmqlvoE5p+vHuuMn7AiBds7cjUDTV61M3N+3AKwKUv9oOIZ/NEezF8uoR/xo1rw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5721},"main":"index.js","gitHead":"a829707b1689bdcb97eb34baaaa2e27855dbcffa","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"10.2.4","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"21.5.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_1.0.5_1708650974711_0.0939624674028634","host":"s3://npm-registry-packages"}},"1.0.6":{"name":"kernelsu","version":"1.0.6","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"Apache-2.0","_id":"kernelsu@1.0.6","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"e2f1a88ad8f7d20823ce0ff2a1e4b093d19b086e","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-1.0.6.tgz","fileCount":3,"integrity":"sha512-f4/G9rYKJSQG2LGal/PJIDFY4ytbKxg6d6N4YuIDBX92JLve9WJ36Mmkws7H+laO4yd4mpNM+jrzU1lrXDGWAA==","signatures":[{"sig":"MEUCIDLW7orhVtFufclIGumc81LGyOz50Qo1L9KEbCcSPk3RAiEA6n48WUm/9M57/kCqkzmC+jQf4IBvrr6JLqD9qdl5/Us=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5715},"main":"index.js","gitHead":"8685fa1f603a279f70f19c4e28e7f3c4b86f76f2","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"10.2.4","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"21.5.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_1.0.6_1708695188898_0.7480858737711102","host":"s3://npm-registry-packages"}},"2.1.1":{"name":"kernelsu","version":"2.1.1","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"Apache-2.0","_id":"kernelsu@2.1.1","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"9833a396e987adf257e7120456a824188459646e","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-2.1.1.tgz","fileCount":4,"integrity":"sha512-P5kC9E4NLzdZbU2O6AysMWC2P2a2TM2VU4ugKjh262bm6Q+FelKhcfdbJD/+ZI7m4OAtldb+8U2c7ZxvQvJRdQ==","signatures":[{"sig":"MEYCIQC1XKrEwhuX62y5/HPgPdCYEKsXqv5wrizMrEUqRCdL0gIhALOkY20J7Fd2OdvR53twdBbYDeIV0ET1THIHu60BUW0H","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8978},"main":"index.js","types":"index.d.ts","gitHead":"e9886ff40ba56a824c9335b43de8b8024a9b0cad","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"11.4.2","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"24.1.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_2.1.1_1763100770158_0.6544172566699591","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"kernelsu","version":"3.0.0","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"Apache-2.0","_id":"kernelsu@3.0.0","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"5add39c18b49455323e887d5df4c8133fa22c9ed","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-3.0.0.tgz","fileCount":4,"integrity":"sha512-7BUHzVe7MOaYV6h9sbhPAf9hFnkXy4Ea1fC1wOF4vrwjExIcFi0OQLSphdZ0sebmIfb14/rgpMXagCYM8RmepQ==","signatures":[{"sig":"MEUCIQCIknv75N5BD3rnfBAB8Fi7c/jNKqtGrGy7shhU6lQydAIgCH69vwTyAi0j08lXo/KCp1msLLeqc4tQfPkh+j95Hzw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9629},"main":"index.js","types":"index.d.ts","gitHead":"641406111c38e2cb4a6e31fe78949a44e315d380","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"11.6.2","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_3.0.0_1766481944200_0.28839378177016584","host":"s3://npm-registry-packages-npm-production"}},"3.0.2":{"name":"kernelsu","version":"3.0.2","keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"Apache-2.0","_id":"kernelsu@3.0.2","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"homepage":"https://github.com/tiann/KernelSU#readme","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"728e88400af8987b03192b50cd28669e7d383de0","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-3.0.2.tgz","fileCount":4,"integrity":"sha512-3MTGgIbl3TWCzqnJP6Fun9tHv6VULR3O188U3raeGRSMzK+G3pldL9ySwaZWhsHCtI2BTvlQuu/3p10s4a5c3w==","signatures":[{"sig":"MEUCIG0KGJc2Yanjkrx1ys1cOrUCKQeX0FMGjbUAeWZI70ARAiEApKm7aGkbMQMd7XKis9TkD29DXtXDj5MtySRCZUcgmTI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9841},"main":"index.js","types":"index.d.ts","gitHead":"92aff05fba3b0f2d031fdaac83cd9aecdfeac7f6","scripts":{"test":"npm run test"},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"11.6.2","description":"Library for KernelSU's module WebUI","directories":{},"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kernelsu_3.0.2_1770258016139_0.6259771157242524","host":"s3://npm-registry-packages-npm-production"}},"3.3.0":{"_id":"kernelsu@3.3.0","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"dist":{"shasum":"d63f87919e7b0daa2827d1156e43bfe43fb1200b","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-3.3.0.tgz","fileCount":4,"integrity":"sha512-iM3xJ/XHzshp6GuRj0WAURN86Q2mEDVxGFbdDSs+OqnDjLP9KVsmkPdqqL3ibu/Gbr9uDaIDuOqli4XCFy01Pw==","signatures":[{"sig":"MEUCIGM3QUysKolpHwuYv7BTNR8vaYlN+gsIxP14WRF9fpAJAiEA0wKms48cutneqbQdoaDN5GEXJkc6HQv0j9qyMjkT8Gg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC+8DcJ9sQCaT9vy9wSzrXz/WlVmcToGJkDxxy2C/4dOgIgYPEgcVxKSJLaCorAL0zM4h/ArNzaa1ihYgjEMnaSS6g="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/kernelsu@3.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":28471},"main":"index.js","name":"kernelsu","types":"index.d.ts","author":{"name":"weishu"},"gitHead":"7bab12df939668a4406cec4c07f4e2b3c555e6b7","license":"Apache-2.0","scripts":{"test":"npm run test"},"version":"3.3.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"7aa11116-1018-4ab0-b9f9-ac5e33588bcb"}},"homepage":"https://github.com/tiann/KernelSU#readme","keywords":["su","kernelsu","module","webui"],"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"_npmVersion":"12.1.0","description":"Library for KernelSU's module WebUI","directories":{},"maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"_nodeVersion":"27.0.0-alpha.0.0.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kernelsu_3.3.0_1793331850158_0.7571585413567495"}}},"time":{"created":"2024-02-22T12:50:58.747Z","modified":"2026-10-30T03:44:10.720Z","1.0.0":"2024-02-22T12:50:58.992Z","1.0.1":"2024-02-22T13:54:29.866Z","1.0.2":"2024-02-22T14:09:37.660Z","1.0.4":"2024-02-22T16:19:58.543Z","1.0.5":"2024-02-23T01:16:14.868Z","1.0.6":"2024-02-23T13:33:09.046Z","2.1.1":"2025-11-14T06:12:50.326Z","3.0.0":"2025-12-23T09:25:44.329Z","3.0.2":"2026-02-05T02:20:16.292Z","3.3.0":"2026-10-30T03:44:10.328Z"},"bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"author":{"name":"weishu"},"license":"Apache-2.0","homepage":"https://github.com/tiann/KernelSU#readme","keywords":["su","kernelsu","module","webui"],"repository":{"url":"git+https://github.com/tiann/KernelSU.git","type":"git"},"description":"Library for KernelSU's module WebUI","maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"readme":"# Library for KernelSU's module WebUI\n\n## Install\n\n```sh\nyarn add kernelsu\n```\n\n## API\n\n### exec\n\nSpawns a **root** shell and runs a command within that shell, returning a Promise that resolves with the `stdout` and `stderr` outputs upon completion.\n\n- `command` `<string>` The command to run, with space-separated arguments.\n- `options` `<Object>`\n  - `cwd` - Current working directory of the child process.\n  - `env` - Environment key-value pairs.\n\n```javascript\nimport { exec } from 'kernelsu';\n\nconst { errno, stdout, stderr } = await exec('ls -l', { cwd: '/tmp' });\nif (errno === 0) {\n    // success\n    console.log(stdout);\n}\n```\n\n### spawn\n\nSpawns a new process using the given `command` in **root** shell, with command-line arguments in `args`. If omitted, `args` defaults to an empty array.\n\nReturns a `ChildProcess` instance. Instances of `ChildProcess` represent spawned child processes.\n\n- `command` `<string>` The command to run.\n- `args` `<string[]>` List of string arguments.\n- `options` `<Object>`:\n  - `cwd` `<string>` - Current working directory of the child process.\n  - `env` `<Object>` - Environment key-value pairs.\n\nExample of running `ls -lh /data`, capturing `stdout`, `stderr`, and the exit code:\n\n```javascript\nimport { spawn } from 'kernelsu';\n\nconst ls = spawn('ls', ['-lh', '/data']);\n\nls.stdout.on('data', (data) => {\n  console.log(`stdout: ${data}`);\n});\n\nls.stderr.on('data', (data) => {\n  console.log(`stderr: ${data}`);\n});\n\nls.on('exit', (code) => {\n  console.log(`child process exited with code ${code}`);\n});\n```\n\n#### ChildProcess\n\n##### Event 'exit'\n\n- `code` `<number>` The exit code if the child process exited on its own.\n\nThe `'exit'` event is emitted when the child process ends. If the process exits, `code` contains the final exit code; otherwise, it is null.\n\n##### Event 'error'\n\n- `err` `<Error>` The error.\n\nThe `'error'` event is emitted whenever:\n\n- The process could not be spawned.\n- The process could not be killed.\n\n##### `stdout`\n\nA `Readable Stream` that represents the child process's `stdout`.\n\n```javascript\nconst subprocess = spawn('ls');\n\nsubprocess.stdout.on('data', (data) => {\n  console.log(`Received chunk ${data}`);\n});\n```\n\n#### `stderr`\n\nA `Readable Stream` that represents the child process's `stderr`.\n\n### fullScreen\n\nRequest the WebView enter/exit full screen.\n\n```javascript\nimport { fullScreen } from 'kernelsu';\nfullScreen(true);\n```\n\n### enableEdgeToEdge\n\nRequest the WebView to set padding to 0 or safeDrawing insets\n\n- tips: this is disabled by default but if you request resource from `internal/insets.css`, this will be enabled automatically.\n- To get insets value and enable this automatically, you can\n  - add `@import \"https://mui.kernelsu.org/internal/insets.css\";` in css OR\n  - add `<link rel=\"stylesheet\" type=\"text/css\" href=\"/internal/insets.css\" />` in html.\n\n```javascript\nimport { enableEdgeToEdge } from 'kernelsu';\nenableEdgeToEdge(true);\n```\n\n### toast\n\nShow a toast message.\n\n```javascript\nimport { toast } from 'kernelsu';\ntoast('Hello, world!');\n```\n\n### moduleInfo\n\nGet module info.\n\n```javascript\nimport { moduleInfo } from 'kernelsu';\n// print moduleId in console\nconsole.log(moduleInfo());\n```\n\n### pm\n\nPackage-manager helpers, multi-user aware. A package installed for several users (e.g. `com.android.bluetooth` with uid `1002` for user 0 and `1001002` for user 10) is listed once by `pm.listPackages`, and yields one info entry per uid from `pm.getPackagesInfo`.\n\n```javascript\nimport { pm } from 'kernelsu';\n\nconst packages = pm.listPackages('user');\nconst infos = pm.getPackagesInfo(['com.android.settings', 'com.android.shell']);\n```\n\n#### pm.support\n\n`boolean` — whether the multi-user pm interface is available in the current environment. Evaluated once when the module loads.\n\n#### pm.version\n\n`number` — the pm API version provided by the manager (Kotlin side) through the `ksu.pm` bridge. `0` when the bridge is unavailable.\n\n#### pm.listPackages\n\nList installed package names, deduplicated across users.\n\nReturns an array of unique package names.\n\n- `type` `<string>` The type of packages to list: \"user\", \"system\", or \"all\".\n\n```javascript\nimport { pm } from 'kernelsu';\n// list user packages\nconst packages = pm.listPackages(\"user\");\n```\n\n- tips: when `pm.listPackages` api is available, you can use ksu://icon/{packageName} to get app icon.\n\n``` javascript\nimg.src = \"ksu://icon/\" + packageName;\n```\n\n#### pm.getPackagesInfo\n\nGet information for a list of packages, one entry per uid.\n\nReturns a flat array: one entry per uid for each resolved package, following the input package order, with uids ascending within a package. If a package is missing or inaccessible, the corresponding entry contains `packageName` and `error` instead.\n\n- `packages` `<string[]>` The list of package names.\n\n#### PackageInfoPerUid\n\nAn object contains:\n\n- `packageName` `<string>` Package name of the application.\n- `versionName` `<string>` Version of the application. Empty string if unavailable.\n- `versionCode` `<number>` Version code of the application.\n- `appLabel` `<string>` Display name of the application.\n- `isSystem` `<boolean | null>` Whether the application is a system app. `null` if application info is unavailable.\n- `uid` `<number | null>` UID of the application for one user, e.g. `1002` or `1001002`. `null` if application info is unavailable.\n- `userId` `<number | null>` User id the uid belongs to, i.e. `uid / 100000`. `null` if application info is unavailable.\n\nIf a package could not be resolved, the returned object contains:\n\n- `packageName` `<string>` The requested package name.\n- `error` `<string>` Reason the package information could not be returned.\n\n### exit\n\nExit the current WebUI activity.\n\n```javascript\nimport { exit } from 'kernelsu';\nexit();\n```\n\n### io\n\nThe exported `io` object provides file system operations with root access. It acts as a small facade over the WebUI file APIs, exposing Java-IO-style factory methods such as `io.File()`, `io.FileInputStream()`, `io.FileOutputStream()`, and `io.RandomAccessFile()`.\n\n```javascript\nimport { io } from 'kernelsu';\n```\n\n#### io.support\n\n`boolean` — whether the advanced file interface is available in the current environment. Evaluated once when the module loads.\n\n#### io.version\n\n`number` — the io API version provided by the manager (Kotlin side) through the `ksu.io` bridge. `0` when the bridge is unavailable.\n\n```javascript\nimport { io, toast } from 'kernelsu';\n\nif (!io.support) {\n    toast('Current environment does not support the advanced file interface. Please update KernelSU Manager.');\n    return;\n}\nconst writer = io.FileOutputStream();\n```\n\n#### io.File\n\nRepresents a file or directory path. All operations execute via root shell.\n\n**Error handling**: Methods return default values (false, empty arrays, -1, etc.) on error.\nCheck return values carefully. For example, `exists()` returns false both when a file doesn't\nexist and when permission is denied. Use multiple checks to disambiguate (e.g., check parent\ndirectory permissions if a file operation fails).\n\n```javascript\nconst file = io.File('/data/adb/modules');\n\nif (file.exists()) {\n    console.log(file.listFiles());\n}\n```\n\n##### Methods\n\n- `exists(): boolean` — Check if path exists\n- `isFile(): boolean` — Check if path is a regular file\n- `isDirectory(): boolean` — Check if path is a directory\n- `canRead(): boolean` — Check read permission\n- `canWrite(): boolean` — Check write permission\n- `canExecute(): boolean` — Check execute permission\n- `createNewFile(): boolean` — Create a new empty file\n- `delete(): boolean` — Delete file or empty directory\n- `deleteRecursive(): boolean` — Recursively delete directory\n- `mkdir(): boolean` — Create directory\n- `mkdirs(): boolean` — Create directory and all parent directories\n- `renameTo(destPath: string): boolean` — Rename or move file\n- `list(): string[]` — List filenames in directory\n- `listFiles(): string[]` — List full paths of files in directory\n- `length(): number` — File size in bytes\n- `lastModified(): number` — Last modified timestamp (ms)\n- `setLastModified(time: number): boolean` — Set last modified time\n- `getAbsolutePath(): string` — Absolute path\n- `getCanonicalPath(): string` — Canonical path (resolves symlinks)\n- `getParent(): string | null` — Parent directory path\n- `getPath(): string` — Path string\n- `getName(): string` — File/directory name\n- `isHidden(): boolean` — Check if hidden\n- `isBlock(): boolean` — Check if block device\n- `isCharacter(): boolean` — Check if character device\n- `isSymlink(): boolean` — Check if symbolic link\n- `createNewSymlink(target: string): boolean` — Create symbolic link\n- `createNewLink(existing: string): boolean` — Create hard link\n- `clear(): boolean` — Truncate file to zero length\n- `setReadOnly(): boolean` — Set read-only\n- `setReadable(readable: boolean, ownerOnly: boolean): boolean` — Set read permission\n- `setWritable(writable: boolean, ownerOnly: boolean): boolean` — Set write permission\n- `setExecutable(executable: boolean, ownerOnly: boolean): boolean` — Set execute permission\n- `getFreeSpace(): number` — Free space on partition\n- `getTotalSpace(): number` — Total space on partition\n- `getUsableSpace(): number` — Usable space on partition\n- `newInputStream(): string` — Open input stream, returns stream ID\n- `newOutputStream(append?: boolean): string` — Open output stream, returns stream ID\n\n#### io.FileInputStream\n\nRead file contents as base64-encoded chunks.\n\n**Error handling**: Methods return empty string or 0 on error. Always check `open()` return\nvalue before using the stream ID. Close streams when done to avoid resource leaks.\n\n```javascript\nconst reader = io.FileInputStream();\nconst id = reader.open('/data/adb/ksu.log');\n\nif (!id) {\n    console.error('Failed to open file');\n} else {\n    let chunk;\n    while ((chunk = reader.read(id)) !== '') {\n        console.log(atob(chunk));\n    }\n    reader.close(id);\n}\n```\n\n##### Methods\n\n- `open(path: string): string` — Open file for reading, returns stream ID\n- `read(id: string): string` — Read chunk (up to 8KB), returns base64 string (empty on EOF)\n- `read(id: string, maxBytes: number): string` — Read up to maxBytes, returns base64 string\n- `available(id: string): number` — Estimated bytes available\n- `close(id: string): boolean` — Close stream\n\n#### io.FileOutputStream\n\nWrite file contents from base64-encoded data.\n\n**Error handling**: Methods return false on error. Always check `open()` and `write()` return\nvalues. Close streams when done to avoid resource leaks.\n\n```javascript\nconst writer = io.FileOutputStream();\nconst id = writer.open('/data/adb/output.txt');\n\nif (!id) {\n    console.error('Failed to open file for writing');\n} else {\n    if (!writer.write(id, btoa('Hello, World!'))) {\n        console.error('Write failed');\n    }\n    writer.close(id);\n}\n```\n\n##### Methods\n\n- `open(path: string, append?: boolean): string` — Open file for writing, returns stream ID\n- `write(id: string, base64: string): boolean` — Write base64 data. For large sequential writes, prefer large chunks (for example 1-2 MiB) to reduce WebView bridge overhead.\n- `writeByte(id: string, b: number): boolean` — Write single byte\n- `flush(id: string): boolean` — Flush buffer\n- `close(id: string): boolean` — Close stream\n\n#### io.RandomAccessFile\n\nRandom access file I/O with seek support. Uses `dd` under the hood, so each operation has overhead. Prefer `FileInputStream`/`FileOutputStream` for sequential access.\n\n**Error handling**: Methods return default values on error (0, -1, false, empty string, null).\nAlways check `open()` return value before using the file ID. Close files when done to avoid\nresource leaks.\n\n```javascript\nconst raf = io.RandomAccessFile();\nconst id = raf.open('/data/adb/data.bin', 'rw');\n\nif (!id) {\n    console.error('Failed to open file');\n} else {\n    raf.seek(id, 1024);\n    raf.writeInt(id, 42);\n    raf.seek(id, 1024);\n    console.log(raf.readInt(id));\n    \n    raf.close(id);\n}\n```\n\n##### Methods\n\n- `open(path: string, mode: string): string` — Open file with mode (`\"r\"`, `\"rw\"`, etc.), returns file ID\n- `read(id: string): number` — Read single byte (0-255, or -1 on EOF)\n- `readBytes(id: string, len: number): string` — Read bytes, returns base64 string\n- `readBoolean(id: string): boolean` — Read boolean\n- `readByte(id: string): number` — Read signed byte\n- `readInt(id: string): number` — Read 32-bit integer\n- `readLong(id: string): number` — Read 64-bit integer\n- `readShort(id: string): number` — Read 16-bit short\n- `readFloat(id: string): number` — Read 32-bit float\n- `readDouble(id: string): number` — Read 64-bit double\n- `readUTF(id: string): string` — Read UTF string\n- `readLine(id: string): string | null` — Read line\n- `write(id: string, b: number): void` — Write single byte\n- `writeBase64(id: string, data: string): void` — Write base64 data\n- `writeBoolean(id: string, v: boolean): void` — Write boolean\n- `writeByte(id: string, v: number): void` — Write byte\n- `writeInt(id: string, v: number): void` — Write 32-bit integer\n- `writeLong(id: string, v: number): void` — Write 64-bit integer\n- `writeShort(id: string, v: number): void` — Write 16-bit short\n- `writeFloat(id: string, v: number): void` — Write 32-bit float\n- `writeDouble(id: string, v: number): void` — Write 64-bit double\n- `writeUTF(id: string, str: string): void` — Write UTF string\n- `seek(id: string, pos: number): boolean` — Set file pointer position\n- `getFilePointer(id: string): number` — Get current file pointer position\n- `length(id: string): number` — Get file length\n- `setLength(id: string, newLength: number): boolean` — Truncate or extend file\n- `close(id: string): boolean` — Close file\n","readmeFilename":"README.md"}