opener
Opens stuff, like webpages and files and executables, cross-platform
Last updated 2 years ago by domenic .
(WTFPL OR MIT) · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install opener 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.5.1                                ...           latest (2 years ago)

11 Versions

  • 1.5.1                                ...           2 years ago
  • 1.5.0                                ...           2 years ago
  • 1.4.3                                ...           3 years ago
  • 1.4.2                                ...           4 years ago
  • 1.4.1                                ...           5 years ago
  • 1.4.0                                ...           6 years ago
  • 1.3.0                                ...           8 years ago
  • 1.2.0                                ...           8 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 1,098
This Week 1,098
This Month 1,098
Last Day 7,227
Last Week 133,914
Last Month 526,262
Dependencies (0)
None
Dev Dependencies (1)
Dependents (614)

Copyright 2014 - 2016 © taobao.org |