fc-filepick

File Picker for Command Line Applications using enquirer

Usage no npm install needed!

<script type="module">
  import fcFilepick from 'https://cdn.skypack.dev/fc-filepick';
</script>

README

Table of Contents generated with DocToc

FC-Filepick

A file picker made for node cli applications using enquirer.

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);
});