/fc-filepick

Primary LanguageJavaScript

Table of Contents generated with DocToc

FC-Filepick

A file picker made for node cli applications using enquirer.

image

Installation

yarn add -D fc-filepick

Methods

Select a directory

const fcFilepicker = require("fc-filepick");

(async () => {
  let dirLocation = await fcFilepicker();
  console.info("Location of folder: ", dirLocation);
})();

Select a file

const fcFilepicker = require("fc-filepick");

(async () => {
  let fileLocation = await fcFilepicker({ type: "file" });
  console.info("Location of file: ", fileLocation);
})();

Options

  • question (string) Show the question for select the file. Default: 'Choose a file/folder'.
  • type (string) folder/file select a folder or file . Default: 'folder'.
  • folder (string) Starting location of search. Default: '.'.

Example

const fcFilepicker = require("fc-filepick");

fcFilepicker({ type: "file" }).then(location => {
  console.info("Location of file: ", fileLocation);
});