{"_id":"kernelsu","_rev":"9-5dd929fcc72987360c98d4174b4faff3","name":"kernelsu","dist-tags":{"latest":"3.0.2"},"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","description":"Library for KernelSU's module WebUI","main":"index.js","types":"index.d.ts","scripts":{"test":"npm run test"},"repository":{"type":"git","url":"git+https://github.com/tiann/KernelSU.git"},"keywords":["su","kernelsu","module","webui"],"author":{"name":"weishu"},"license":"Apache-2.0","bugs":{"url":"https://github.com/tiann/KernelSU/issues"},"homepage":"https://github.com/tiann/KernelSU#readme","gitHead":"92aff05fba3b0f2d031fdaac83cd9aecdfeac7f6","_id":"kernelsu@3.0.2","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-3MTGgIbl3TWCzqnJP6Fun9tHv6VULR3O188U3raeGRSMzK+G3pldL9ySwaZWhsHCtI2BTvlQuu/3p10s4a5c3w==","shasum":"728e88400af8987b03192b50cd28669e7d383de0","tarball":"https://registry.npmjs.org/kernelsu/-/kernelsu-3.0.2.tgz","fileCount":4,"unpackedSize":9841,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIG0KGJc2Yanjkrx1ys1cOrUCKQeX0FMGjbUAeWZI70ARAiEApKm7aGkbMQMd7XKis9TkD29DXtXDj5MtySRCZUcgmTI="}]},"_npmUser":{"name":"twsxtd","email":"twsxtd@gmail.com"},"directories":{},"maintainers":[{"name":"twsxtd","email":"twsxtd@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kernelsu_3.0.2_1770258016139_0.6259771157242524"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-22T12:50:58.747Z","modified":"2026-02-05T02:20:16.392Z","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"},"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":{"type":"git","url":"git+https://github.com/tiann/KernelSU.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### listPackages\n\nList installed packages.\n\nReturns an array of package names.\n\n- `type` `<string>` The type of packages to list: \"user\", \"system\", or \"all\".\n\n```javascript\nimport { listPackages } from 'kernelsu';\n// list user packages\nconst packages = listPackages(\"user\");\n```\n\n- tips: when `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### getPackagesInfo\n\nGet information for a list of packages.\n\nReturns an array of `PackagesInfo` objects.\n\n- `packages` `<string[]>` The list of package names.\n\n```javascript\nimport { getPackagesInfo } from 'kernelsu';\nconst packages = getPackagesInfo(['com.android.settings', 'com.android.shell']);\n```\n\n#### PackagesInfo\n\nAn object contains:\n\n- `packageName` `<string>` Package name of the application.\n- `versionName` `<string>` Version of the application.\n- `versionCode` `<number>` Version code of the application.\n- `appLabel` `<string>` Display name of the application.\n- `isSystem` `<boolean>` Whether the application is a system app.\n- `uid` `<number>` UID of the application.\n\n### exit\n\nExit the current WebUI activity.\n\n```javascript\nimport { exit } from 'kernelsu';\nexit();\n```\n","readmeFilename":"README.md"}