Download Fore_End/cpcn2/node_modules/is-docker/index.js from zxy0307/JavaWeb: direct link, hf CLI and curl.
- Browser
- Download file 449 Bytes
-
https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/cpcn2/node_modules/is-docker/index.js
- Command line
-
hf download hf://zxy0307/JavaWeb/Fore_End/cpcn2/node_modules/is-docker/index.js
-
curl -L -o index.js https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/cpcn2/node_modules/is-docker/index.js
449 Bytes
| ; | |
| const fs = require('fs'); | |
| let isDocker; | |
| function hasDockerEnv() { | |
| try { | |
| fs.statSync('/.dockerenv'); | |
| return true; | |
| } catch (_) { | |
| return false; | |
| } | |
| } | |
| function hasDockerCGroup() { | |
| try { | |
| return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker'); | |
| } catch (_) { | |
| return false; | |
| } | |
| } | |
| module.exports = () => { | |
| if (isDocker === undefined) { | |
| isDocker = hasDockerEnv() || hasDockerCGroup(); | |
| } | |
| return isDocker; | |
| }; | |