]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/opener/README.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / opener / README.md
1 # It Opens Stuff
2
3 That is, in your desktop environment. This will make *actual windows pop up*, with stuff in them:
4
5 ```bash
6 npm install opener -g
7
8 opener http://google.com
9 opener ./my-file.txt
10 opener firefox
11 opener npm run lint
12 ```
13
14 Also if you want to use it programmatically you can do that too:
15
16 ```js
17 var opener = require("opener");
18
19 opener("http://google.com");
20 opener("./my-file.txt");
21 opener("firefox");
22 opener("npm run lint");
23 ```
24
25 Plus, it returns the child process created, so you can do things like let your script exit while the window stays open:
26
27 ```js
28 var editor = opener("documentation.odt");
29 editor.unref();
30 // These other unrefs may be necessary if your OS's opener process
31 // exits before the process it started is complete.
32 editor.stdin.unref();
33 editor.stdout.unref();
34 editor.stderr.unref();
35 ```
36
37
38 ## Use It for Good
39
40 Like opening the user's browser with a test harness in your package's test script:
41
42 ```json
43 {
44     "scripts": {
45         "test": "opener ./test/runner.html"
46     },
47     "devDependencies": {
48         "opener": "*"
49     }
50 }
51 ```
52
53 ## Why
54
55 Because Windows has `start`, Macs have `open`, and *nix has `xdg-open`. At least
56 [according to some guy on StackOverflow](http://stackoverflow.com/q/1480971/3191). And I like things that work on all
57 three. Like Node.js. And Opener.