skratchdot/open-golang
GitHub: skratchdot/open-golang
该库封装了各操作系统打开文件和链接的底层命令,让 Go 程序能跨平台调用默认应用程序打开指定对象。
Stars: 814 | Forks: 62
# 打开
## 描述
```
Open a file, directory, or URI using the OS's default application for
that object type. Optionally, you can specify an application to use.
This is a proxy for the following commands:
OSX: "open"
Windows: "start"
Linux/Other: "xdg-open"
This is a golang port of the node.js module:
https://github.com/pwnall/node-open
```
## 文档
[http://godoc.org/github.com/skratchdot/open-golang/open](http://godoc.org/github.com/skratchdot/open-golang/open)
## 导入
```
import "github.com/skratchdot/open-golang/open"
```
## 用法
### 在用户的默认浏览器中打开 google.com(方法 1):
```
open.Run("https://google.com/")
```
### 在用户的默认浏览器中打开 google.com(方法 2):
```
open.Start("https://google.com")
```
### 你可以监听错误
```
err := open.Run("https://google.com/")
```
### 你可以指定要使用的程序
```
open.RunWith("https://google.com/", "firefox")
```
## 函数
### func Run(input string) error
```
Open a file, directory, or URI using the OS's default application for
that object type. Wait for the open command to complete.
```
### func RunWith(input string, appName string) error
```
Open a file, directory, or URI using the specified application. Wait for
the open command to complete.
```
### func Start(input string) error
```
Open a file, directory, or URI using the OS's default application for
that object type. Don't wait for the open command to complete.
```
### func StartWith(input string, appName string) error
```
Open a file, directory, or URI using the specified application. Don't
wait for the open command to complete.
```
## 许可证
版权所有 (c) 2013 skratchdot
基于 MIT 许可证授权。
标签:EVTX分析, 日志审计