hashrock / deno-opn

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

Home Page:https://doc.deno.land/https/raw.githubusercontent.com/hashrock/deno-opn/master/opn.ts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deno Opn

A port of OPN



Badge LicenseBadge PortBadge Opn



Usage


Import

Latest

Use the bleeding edge.

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

Use a specific Release tag.

import { open } from 'https://github.com/hashrock/deno-opn/raw/<Version Tag>/mod.ts'

v2.0.0

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

v1.1.1(legacy)

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

File

Open a file with the default image viewer.

await open('unicorn.png');

URL

Open a URL in the default browser.

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

With

Open the target with a specific program.

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

Arguments

Supply the program with arguments.

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 :)


About

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

https://doc.deno.land/https/raw.githubusercontent.com/hashrock/deno-opn/master/opn.ts

License:MIT License


Languages

Language:TypeScript 58.6%Language:JavaScript 41.4%