Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • npm
  • Socket score

Version published
Maintainers
1
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

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc