New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

win-dialogs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

win-dialogs

Node.js wrapper for native Windows file and folder dialogs using PowerShell.

latest
Source
npmnpm
Version
1.4.0
Version published
Maintainers
1
Created
Source

win-dialogs

NPM Downloads npm license npm bundle size NPM Downloads by package author

File dialogs for Node.js.
Uses PowerShell and .NET WinForms to open native Windows file/folder dialogs with support for Folder Picking and File Picking and customizable options.

❗ Notes

  • This module only works on Windows.
  • Requires access to PowerShell + .NET Forms.
  • Dialogs are asynchronous

📦 Installation

npm install win-dialogs

Requires Windows with PowerShell and .NET Framework installed (available on all Windows 7+ systems).

🧠 Features

  • Native Windows File & Folder dialogs

  • Supports:

    • FolderBrowserDialog (single)
    • OpenFileDialog (single or multiple)
    • OpenFolderDialog (single or multiple)
  • Customizable dialog parameters (title, filters, default name, etc)

  • Compatible with both CommonJS and ES Modules

🚀 Simple Usage

ES Modules

import { OpenFolderDialog } from 'win-dialogs';

const folder = await OpenFolderDialog('Choose a folder', 'SelectHere');
console.log('Selected folder:', folder);

CommonJS

const { OpenFileDialog } = require('win-dialogs');

OpenFileDialog('Pick a file', 'All Files (*.*)|*.*')
  .then(console.log)
  .catch(console.error);

📘 Functions

FolderBrowserDialog(description?, rootFolder?, etcParams?)

Opens a classic folder picker dialog.

ParamTypeDefaultDescription
descriptionstring"Select Folder"Text to display inside the dialog
rootFolderstring"Desktop"Special folder name or full path
etcParamsobject{}Additional WinForms dialog options

OpenFileDialog(title?, filter?, multiSelect?, initialDir?, etcParams?)

Opens a file dialog.

ParamTypeDefault
titlestring"Select File"
filterstring"All Files (*.*)*.*"
multiSelectbooleanfalse
initialDirstring"Desktop"
etcParamsDialogOptions{}

OpenFolderDialog(title?, initialName?, initialDir?, multiSelect?, etcParams?)

Opens a folder dialog.

ParamTypeDefault
titlestring"Select Folder"
initialNamestring"Select a Folder"
initialDirstring"Desktop"
multiSelectbooleanfalse
etcParamsDialogOptions{}

🛠 Some etcParams Options

OptionTypeDescription
ValidateNamesbooleanAllow/disallow invalid filenames
CheckFileExistsbooleanRequire existing files
CheckPathExistsbooleanRequire existing paths
RestoreDirectorybooleanResets directory after use
DefaultExtstringDefault file extension (e.g. "txt")
AddExtensionbooleanAutomatically append extension
SupportMultiDottedExtensionsbooleanSupport .tar.gz, .config.js, etc.

💡 OpenFolderDialog Example

const selected = await OpenFolderDialog('Choose Folder', 'Select a folder now', 'Desktop', false, {
	CheckPathExists: true,
	ValidateNames: false,
});

console.log('You picked:', selected);

💡 FolderBrowserDialog Example

const selected = await FolderBrowserDialog('Select Folder', 'C:\\', {});

console.log('You picked:', selected);

💡 OpenFileDialog Example

const selected = await OpenFileDialog('Select Folder', 'Office Files|*.doc;*.xls;*.ppt' 'C:\\', {});

console.log('You picked:', selected);

🧩 TypeScript Support

import { OpenFolderDialog, DialogOptions } from 'win-dialogs';

const options: DialogOptions = {
	CheckPathExists: true
};

const folder = await OpenFolderDialog('Choose', 'Choose a folder', 'Desktop', false, options);

Keywords

windows

FAQs

Package last updated on 17 May 2025

Did you know?

Socket

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.

Install

Related posts