node/deps/npm/node_modules/opener
Audrey Eschright 13ae5385ae
deps: upgrade npm to 6.5.0
PR-URL: https://github.com/nodejs/node/pull/24734
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2018-12-25 15:15:54 -05:00
..
bin deps: upgrade npm to 6.4.1 2018-09-02 12:51:59 +02:00
lib deps: upgrade npm to 6.5.0 2018-12-25 15:15:54 -05:00
LICENSE.txt deps: upgrade npm to 6.4.1 2018-09-02 12:51:59 +02:00
README.md deps: upgrade npm to 6.4.1 2018-09-02 12:51:59 +02:00
package.json deps: upgrade npm to 6.5.0 2018-12-25 15:15:54 -05:00

README.md

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.