Socket
Socket
Sign inDemoInstall

is-wsl

Package Overview
Dependencies
2
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-wsl

Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)


Version published
Maintainers
1
Install size
9.90 kB
Created

Package description

What is is-wsl?

The is-wsl npm package is used to check if the current environment is running inside Windows Subsystem for Linux (WSL). It is a simple utility that can be used in Node.js applications to tailor behavior based on whether the code is executing in WSL or not.

What are is-wsl's main functionalities?

Detecting WSL environment

This feature allows developers to determine if their Node.js code is running inside WSL. The package exports a boolean value that is true if the environment is detected as WSL, and false otherwise. The code sample demonstrates how to use this boolean to conditionally execute code based on the environment.

const isWsl = require('is-wsl');

if (isWsl) {
  console.log('Running inside Windows Subsystem for Linux');
} else {
  console.log('Not running inside WSL');
}

Other packages similar to is-wsl

Readme

Source

is-wsl

Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)

Can be useful if you need to work around unimplemented or buggy features in WSL. Supports both WSL 1 and WSL 2.

Install

npm install is-wsl

Usage

import isWsl from 'is-wsl';

// When running inside Windows Subsystem for Linux
console.log(isWsl);
//=> true

Keywords

FAQs

Last updated on 25 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc