
Product
Introducing Immutable Scans
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.
open-file-manager
Advanced tools
Cross-platform utility to open a file or directory in the system's default file manager (Finder, Explorer, Nautilus, etc.)
Cross-platform utility to open a file or directory in the system's default file manager (Finder, Explorer, Nautilus, etc.)
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install with npm:
$ npm install --save open-file-manager
import { openFileManager } from "open-file-manager";
// or
import openFileManager from "open-file-manager";
Opens a file or directory in the system's default file manager.
export const openFileManager = async (dirname?: string): Promise<void>;
Basic usage:
// Open current directory
await openFileManager();
// Open specific directory
await openFileManager("/home/user/documents");
// Open file location (selects the file in the file manager)
await openFileManager("./package.json");
Parameters:
pathname (optional)
string'.' (current directory)Returns:
Promise<void>Platform behavior:
explorer.exe. When opening a file, it selects the file in Explorer.open -R to reveal the item in Finder.Error handling:
try {
await openFileManager("/path/to/file");
} catch (error) {
console.error("Failed to open file manager:", error.message);
}
# Open current directory
open-file-manager
# Open specific directory
open-file-manager /home/user/documents
# Open file location
open-file-manager ./package.json
# Show help
open-file-manager --help
# Show version
open-file-manager --version
import { openFileManager } from "open-file-manager";
await openFileManager("./dist");
// This will open the file manager and select/highlight the file
await openFileManager("./README.md");
{
"scripts": {
"open:dist": "open-file-manager ./dist",
"open:current": "open-file-manager"
}
}
import { openFileManager } from "open-file-manager";
import path from "node:path";
// Works on Windows, macOS, and Linux
await openFileManager('/path/to/dir');
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
Jon Schlinkert
Copyright © 2025, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on May 25, 2025.
FAQs
Cross-platform utility to open a file or directory in the system's default file manager (Finder, Explorer, Nautilus, etc.)
The npm package open-file-manager receives a total of 2 weekly downloads. As such, open-file-manager popularity was classified as not popular.
We found that open-file-manager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.