All specs
Interactive · file-picker

File Picker

Interactive file and directory browser.

Anatomy

~/projects/acme-cli

▸ src/
· package.json
· tsconfig.json
· README.md

↑↓ navigate · ↵ select/enter · backspace up · esc cancel

Usage

const file = await filePicker({
  cwd: process.cwd(),
  filter: (name, isDir) => isDir || name.endsWith('.ts'),
})

if (file) {
  console.log('Selected:', file)
}

Options

KeyTypeDefaultDescription
cwdstring?cwd()Starting directory
filter(name, isDir) => booleanFilter entries
showHiddenboolean?falseShow dotfiles
limitnumber?15Max visible items
selectDirectoriesboolean?falseAllow selecting directories

Keyboard

KeyAction
Previous entry
Next entry
Enter directory / select file
backspaceGo to parent directory
escCancel → null

Do & don't

Do — use for selecting files interactively (config paths, output dirs)

Don't — use for displaying directory trees (use tree); don't use in non-TTY

Out of scope

Multi-select files

File preview

Inline rename/delete

Remote file systems