Socket
Book a DemoInstallSign in
Socket

inquirer-file-selector-prompt

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer-file-selector-prompt

File selector interface for inquirer

1.1.0
latest
npmnpm
Version published
Weekly downloads
21
-40%
Maintainers
1
Weekly downloads
 
Created
Source

Inquirer File Selector Prompt

A plugin for Inquirer, allowing users to navigate their file directories to select files.

npm npm

Demo

Installation

npm install --save inquirer-file-selector-prompt

Usage

Register the prompt under any alias you prefer then use the prompt as you would any other inquirer prompt.

inquirer.registerPrompt('file-selector', require('inquirer-file-selector-prompt'));

inquirer.prompt({
  type: 'file-selector',
  ...
})

Options

Takes type, name, message, [filter, validate, default, pageSize, path, extensions, selectionType, onlyShowMatchingExtensions] properties.

The extra options that this plugin provides are:

  • path
    Type: string
    Description: Starting directory for the prompt
    Default: process.cwd()
  • extensions
    Type: Array<string>
    Description: Array of valid extensions to pick from
    Default: [] (any extension)
  • selectionType
    Type: string
    Description: Choose whether to select a file or directory
    Valid options: ["file","folder","either"]
    Default: "file"
  • onlyShowMatchingExtensions
    Type: boolean
    Description: Select whether to hide files that do not match the specified valid extensions
    Default: false

Example

const inquirer = require('inquirer');
const fileSelector = require('./index.js');

inquirer.registerPrompt('file-tree-selection', fileSelector);

inquirer
	.prompt([
		{
			type: 'file-tree-selection',
			name: 'file',
			message: 'choose a file',
			extensions: ['js']
		}
	])
	.then(answers => {
		console.log(JSON.stringify(answers));
	});

License

This project is under the MIT license.

Keywords

inquirer

FAQs

Package last updated on 27 Sep 2019

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.