pax_global_header00006660000000000000000000000064130507207020014506gustar00rootroot0000000000000052 comment=51a4058b9e5172d9b57fb5e5205bc3f7fb4ace6a opener-1.4.3/000077500000000000000000000000001305072070200130035ustar00rootroot00000000000000opener-1.4.3/.gitignore000066400000000000000000000000361305072070200147720ustar00rootroot00000000000000/node_modules/ /npm-debug.log opener-1.4.3/.jshintrc000066400000000000000000000005341305072070200146320ustar00rootroot00000000000000{ "bitwise": true, "camelcase": true, "curly": true, "eqeqeq": true, "globalstrict": true, "immed": true, "indent": 4, "latedef": "nofunc", "maxlen": 120, "newcap": true, "noarg": true, "node": true, "nonew": true, "trailing": true, "undef": true, "unused": true, "white": true } opener-1.4.3/LICENSE.txt000066400000000000000000000035351305072070200146340ustar00rootroot00000000000000Dual licensed under WTFPL and MIT: --- Copyright © 2012–2016 Domenic Denicola This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See below for more details. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. --- The MIT License (MIT) Copyright © 2012–2016 Domenic Denicola Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. opener-1.4.3/README.md000066400000000000000000000024251305072070200142650ustar00rootroot00000000000000# It Opens Stuff That is, in your desktop environment. This will make *actual windows pop up*, with stuff in them: ```bash 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: ```js 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: ```js 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: ```json { "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](http://stackoverflow.com/q/1480971/3191). And I like things that work on all three. Like Node.js. And Opener. opener-1.4.3/opener.js000066400000000000000000000041021305072070200146260ustar00rootroot00000000000000#!/usr/bin/env node "use strict"; var childProcess = require("child_process"); function opener(args, options, callback) { // http://stackoverflow.com/q/1480971/3191, but see below for Windows. var command = process.platform === "win32" ? "cmd" : process.platform === "darwin" ? "open" : "xdg-open"; if (typeof args === "string") { args = [args]; } if (typeof options === "function") { callback = options; options = {}; } if (options && typeof options === "object" && options.command) { if (process.platform === "win32") { // *always* use cmd on windows args = [options.command].concat(args); } else { command = options.command; } } if (process.platform === "win32") { // On Windows, we really want to use the "start" command. But, the rules regarding arguments with spaces, and // escaping them with quotes, can get really arcane. So the easiest way to deal with this is to pass off the // responsibility to "cmd /c", which has that logic built in. // // Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title, // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191 // // Additionally, on Windows ampersand needs to be escaped when passed to "start" args = args.map(function(value) { return value.replace(/&/g, '^&'); }); args = ["/c", "start", '""'].concat(args); } return childProcess.execFile(command, args, options, callback); } // Export `opener` for programmatic access. // You might use this to e.g. open a website: `opener("http://google.com")` module.exports = opener; // If we're being called from the command line, just execute, using the command-line arguments. if (require.main && require.main.id === module.id) { opener(process.argv.slice(2), function (error) { if (error) { throw error; } }); } opener-1.4.3/package.json000066400000000000000000000007511305072070200152740ustar00rootroot00000000000000{ "name": "opener", "description": "Opens stuff, like webpages and files and executables, cross-platform", "version": "1.4.3", "author": "Domenic Denicola (https://domenic.me/)", "license": "(WTFPL OR MIT)", "repository": "domenic/opener", "main": "opener.js", "bin": "opener.js", "files": [ "opener.js" ], "scripts": { "lint": "jshint opener.js" }, "devDependencies": { "jshint": "^2.6.3" } }