opener

Opens stuff, like webpages and files and executables, cross-platform

  • Owner: domenic/opener
  • Platform:
  • License:: Other
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

It Opens Stuff

That is, in your desktop environment. This will make actual windows pop up, with stuff in them:

npm install opener -g

opener http://google.com
opener ./my-file.txt
opener firefox
opener npm run lint

Also if you want to use it programmatically you can do that too:

var opener = require("opener");

opener("http://google.com");
opener("./my-file.txt");
opener("firefox");
opener("npm run lint");

Plus, it returns the child process created, so you can do things like let your script exit while the window stays open:

var editor = opener("documentation.odt");
editor.unref();
// These other unrefs may be necessary if your OS's opener process
// exits before the process it started is complete.
editor.stdin.unref();
editor.stdout.unref();
editor.stderr.unref();

Use It for Good

Like opening the user's browser with a test harness in your package's test script:

{
    "scripts": {
        "test": "opener ./test/runner.html"
    },
    "devDependencies": {
        "opener": "*"
    }
}

Why

Because Windows has start, Macs have open, and *nix has xdg-open. At least according to some guy on StackOverflow. And I like things that work on all three. Like Node.js. And Opener.

Main metrics

Overview
Name With Ownerdomenic/opener
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:Other
所有者活动
Created At2012-08-06 10:40:30
Pushed At2022-08-17 15:12:47
Last Commit At2020-08-29 16:24:31
Release Count12
Last Release Namev1.5.2 (Posted on 2020-08-29 16:24:31)
First Release Name1.0.0 (Posted on )
用户参与
Stargazers Count304
Watchers Count7
Fork Count27
Commits Count36
Has Issues Enabled
Issues Count25
Issue Open Count7
Pull Requests Count7
Pull Requests Open Count1
Pull Requests Close Count7
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private