pwnall / node-open

open a file or uri with the users preferred application (browser, editor, etc), cross platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open local file with URL parameter

mm-gmbd opened this issue · comments

First, thanks for this package!

I'm trying to open a local page (not even served with a local server, just served by the filesystem itself) and supply a URL parameter, but I'm getting an error message.

Example:

var open = require('open');
open('./a/local/file.html?param=hello');

image

I'm guessing it interprets the entirety of the string as the filename.

Interestingly, if I pass chrome as the second argument, it successfully opens chrome, but it just uses the url ./a/local/file.html?param=hello directly rather than adding the path to the file (as it does without the url parameter).

My current workaround is to prepend __dirname to the path, but I still have to supply the second argument:

open(__dirname+'/a/local/file.html?param=hello', 'chrome');

Out-of-the-box support for this (without having to specify the secondary argument) would be nice :)

Thanks,
-Max