{"library":"openurl","title":"Open URLs via Operating System","description":"The `openurl` package provides a simple Node.js module to programmatically open URLs, `mailto:` links, or local files using the operating system's default applications. For instance, `http` links will open in the default web browser, and `mailto` links in the default email client. The package's current and final stable version is `1.1.1`, which was last published over 10 years ago in January 2016. Consequently, `openurl` is no longer actively maintained and does not receive updates, bug fixes, or new features. While it may still function for basic use cases in CommonJS environments, it lacks modern features like native ECMAScript Modules (ESM) support and may have unaddressed platform-specific issues. Developers are strongly encouraged to use actively maintained alternatives like the `open` package (by Sindre Sorhus) for better cross-platform compatibility, ESM support, and ongoing reliability.","language":"javascript","status":"abandoned","last_verified":"Wed Apr 22","install":{"commands":["npm install openurl"],"cli":null},"imports":["const openurl = require('openurl');\nopenurl.open('https://example.com');","const openurl = require('openurl');\nopenurl.mailto(['recipient@example.com'], { subject: 'Hello', body: 'This is a test' });"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const openurl = require('openurl');\n\n// Open a URL in the default web browser\nopenurl.open('https://www.google.com').then(() => {\n  console.log('Opened Google in browser.');\n}).catch(err => {\n  console.error('Failed to open URL:', err.message);\n});\n\n// Open a mailto link in the default email client with recipients, subject, and body\nopenurl.mailto(['john.doe@example.com', 'jane.smith@example.com'], {\n    subject: 'Important Inquiry',\n    body: 'Dear recipients,\\n\\nThis is an automatically generated email.\\n\\nRegards,\\nYour App'\n}).then(() => {\n  console.log('Opened mail client for email.');\n}).catch(err => {\n  console.error('Failed to open mailto link:', err.message);\n});\n\n// Example of opening a local file (path should be absolute for best results)\n// Note: This often opens a directory viewer on some OS if it's a directory path.\n// On macOS, it might open the directory in Finder. On Windows, in Explorer.\nconst filePath = process.platform === 'win32' ? 'C:\\\\Windows' : '/tmp';\nopenurl.open(filePath).then(() => {\n  console.log(`Opened file/directory: ${filePath}`);\n}).catch(err => {\n  console.error('Failed to open file/directory:', err.message);\n});","lang":"javascript","description":"This quickstart demonstrates how to open a web URL, compose an email using a mailto link with multiple recipients, subject, and body, and open a local file path using the operating system's default applications.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}