opener

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

  • 所有者: domenic/opener
  • 平台:
  • 许可证: Other
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

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.

主要指标

概览
名称与所有者domenic/opener
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证Other
所有者活动
创建于2012-08-06 10:40:30
推送于2022-08-17 15:12:47
最后一次提交2020-08-29 16:24:31
发布数12
最新版本名称v1.5.2 (发布于 2020-08-29 16:24:31)
第一版名称1.0.0 (发布于 )
用户参与
星数303
关注者数7
派生数27
提交数36
已启用问题?
问题数25
打开的问题数7
拉请求数7
打开的拉请求数1
关闭的拉请求数7
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?