npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wsl-open

v2.2.1

Published

Utility for opening files from the Windows Subsystem for Linux (WSL) in native Windows applications

Downloads

296

Readme

wsl-open (:open_file_folder: :arrow_right: :computer:)

pipeline
status npm
version

Utility for opening files within the Windows Subsystem for Linux command line in Windows GUI applications.

Usage

Just run wsl-open with the file/directory/URL that you want to open.

wsl-open { FILE | DIRECTORY | URL }
  • FILE paths can be relative or absolute
  • DIRECTORY paths are the same, with a possible limitation*
  • URLs must include the protocol (http://, https://, ftp://, etc) or begin with www, which is consistent with how xdg-open handles URLs

*If using a WSL build without the wslpath (prior to Build 1803 - released April 2018), only Windows directories can be opened

Examples

# Opens in your Windows default image viewer
wsl-open image.png

# Relative and absolute paths work
wsl-open ../Downloads/resume.pdf
wsl-open /home/other/README.txt

# Directories under Windows
wsl-open /mnt/c/Users/4u6u5/Music

# Opens your Windows default browser
wsl-open http://google.com

Set file associations

The real benefit of wsl-open is setting it as the default program in the Windows Subsystem for a particular filetype. This allow you to use Linux's standard xdg-open utility to open files, and wsl-open will handle the rest! This keeps your scripts platform agnostic.

# Set association for file type
wsl-open -a image.png

# Now, you can open up any PNG with xdg-open, and wsl-open will handle it
xdg-open another_image.png

# Unassociate wsl-open with a file type
wsl-open -d image.png

# Associate wsl-open with links (set wsl-open as your shell's BROWSER)
wsl-open -w

# Now URL's work as well!
xdg-open https://gitlab.com/4U6U57/wsl-open

# And this allows other programs that depend on xdg-open to use it as well!
npm repo wsl-open # Same as the previous command

Protip: I like to furthur generalize my scripts by setting alias open='xdg-open' on my Linux machines, which make them behave more like macOS

Full specification

For full details on how the script operates, feel free to check out the manpage or design specification

Installation

npm

The easiest way to get it is to use the Node Package Manager and install it globally.

# Get npm if you don't have it already
sudo apt-get install -yqq npm

# Install
sudo npm install -g wsl-open

Standalone

wsl-open is actually just a single, self contained bash script, so the bare minimum installation is simply downloading the script (either by cloning the repo or via curl) and then adding it to your path. Here is an example:

# Make a bin folder in your home directory
mkdir ~/bin

# Add the bin folder to your PATH in your bashrc
echo '[[ -e ~/bin ]] && export PATH=$PATH:~/bin' >> ~/.bashrc

# Download the script to a file named 'wsl-open'
curl -o ~/bin/wsl-open https://raw.githubusercontent.com/4U6U57/wsl-open/master/wsl-open.sh