Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hashrock/deno-opn

Opens stuff like websites, files, executables. Cross-platform, for Deno.
https://github.com/hashrock/deno-opn

Last synced: 2 days ago
JSON representation

Opens stuff like websites, files, executables. Cross-platform, for Deno.

Awesome Lists containing this project

README

        

# Deno Opn
***A port of [OPN]***






[![Badge License]][License] [![Badge Port]][Hashrock] [![Badge Opn]][Opn]






## Usage


### Import

##### Latest

*Use the bleeding edge.*

```js
import { open } from 'https://github.com/hashrock/deno-opn/raw/master/mod.ts'
```

##### Version

*Use a specific **[Release]** tag.*

```js
import { open } from 'https://github.com/hashrock/deno-opn/raw//mod.ts'
```

v2.0.0

```js
import { open } from 'https://github.com/hashrock/deno-opn/raw/v2.0.0/mod.ts'
```

v1.1.1(legacy)

```js
import { opn } from 'https://github.com/hashrock/deno-opn/raw/v1.1.1/opn.ts'
```


### File

*Open a file with the default image viewer.*

```js
await open('unicorn.png');
```


### URL

*Open a URL in the default browser.*

```js
await open('http://sindresorhus.com');
```


### With

*Open the target with a specific program.*

```js
await open('http://sindresorhus.com',{
with: [ 'firefox' ]
});
```


### Arguments

*Supply the program with arguments.*

```js
await open('http://sindresorhus.com',{
with: [ 'chrome' , '--incognito' ]
});
```




## Design

*Internally system specific commands*

*are used to start the child processes.*


| System | Command
|:----------------:|:----------:
| ![Badge Linux] | `gio open`
| ![Badge MacOS] | `start`
| ![Badge Windows] | `open`




## Contributions

***PRs welcome :)***


[Badge License]: https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge
[Badge Port]: https://img.shields.io/badge/Port-Hashrock-red.svg?style=for-the-badge
[Badge Opn]: https://img.shields.io/badge/Opn-Sindre_Sorhus-green.svg?style=for-the-badge

[Badge Windows]: https://img.shields.io/badge/-0078D6.svg?style=for-the-badge&logo=windows&logoColor=white&logoWidth=200 'Windows'
[Badge Linux]: https://img.shields.io/badge/-87CF3E.svg?style=for-the-badge&logo=linux&logoColor=white&logoWidth=200 'Linux'
[Badge MacOS]: https://img.shields.io/badge/-darkgray.svg?style=for-the-badge&logo=apple&logoColor=white&logoWidth=200 'MacOS'

[Sindre Sorhus]: https://sindresorhus.com 'Sorhus Website'

[Hashrock]: https://github.com/hashrock 'Hashrocks GitHub Profile'
[opn]: https://github.com/sindresorhus/opn 'The OPN Project Page'

[Release]: https://github.com/hashrock/deno-opn/releases
[License]: LICENSE 'The license of this repository'