opencmd
v0.0.0
Published
Universal command to open files, URLs, and applications across platforms
Maintainers
Readme
opencmd
Universal command to open files, URLs, and applications across macOS, Windows, and Linux.
Installation
npm install -g opencmdUsage
CLI
# Open a URL in default browser
opencmd https://google.com
# Open a file with default application
opencmd ./document.pdf
# Open current directory in file manager
opencmd .
# Open with specific application
opencmd -a "Visual Studio Code" .
opencmd --app Safari https://apple.com
# Wait for application to close
opencmd -w ./document.pdfProgrammatic API
const { open } = require('opencmd');
// Open a URL
await open('https://google.com');
// Open a file
await open('./document.pdf');
// Open with specific app
await open('./document.pdf', { app: 'Preview' });
// Wait for app to close
await open('./document.pdf', { wait: true });Features
- Cross-platform: Works on macOS, Windows, and Linux
- Universal: Opens URLs, files, directories, and applications
- Simple: Zero dependencies, lightweight
- Flexible: Use specific applications or defaults
- Promise-based: Async/await support
Platform Support
| Platform | Command Used |
|----------|-------------|
| macOS | open |
| Windows | start |
| Linux | xdg-open |
License
MIT
