FileBrowser is mini File System browser for Scriptable which can be used to:
- browse the local file system1
- browse iCloud folders1
- browse bookmarked folders.
1Files and folders accessible through the sandbox.
Example Usage:
const {FileBrowser} = importModule('file-browser')
const path = FileManager.local().documentsDirectory()
const browser = new FileBrowser(path)
const file = await browser.present()Download
DOWNLOAD using Import-Script or copy the code from file-browser.js and save in Scriptable.
Construct a new FileBrowser.
new FileBrowser(path, options)path : the directory to browse
options : a JSON value indicating the additional options to change the behaviour of the browser
canBrowseParent: Boolean: allow browsing above the initial path. Useful for exploring outside the known directories. Default false.precheckAccess: Boolean: while listing directory contents, check each sub-directory is accessible or not. Inaccessible directories will be colored in red. Default true.fullscreen: Boolean: open the file browser in fullscreen. Default true.
Launches the file browser returns a JSON value containing information about the selected file
present(): Promise<FileInfo>opens a QuickLook onthe file. path is the path to the file. FileBrowser will try to auto-detect images and present the image itself. Any other file will be treated as a text file. If it is unable to read the file contents, it will show <eof>.
previewFile(path:String)Presents a list of built-in directories that Scriptable has access to. Choosing any of them will return the path to that directory.
pickScriptableDirectory(): StringAllow browsing above the inital path. Useful for exploring outside the known directories.
canBrowseParent: BooleanOpen the file browser in full screen.
fullscreen: BooleanThe initial path to use when the FileBrowser is presented. By default, navigating to the parent directory of this folder is not allowed. Pass the canBrowseParent option to override.
path: StringTest and colorized inaccessible sub-directories.
precheckAccess: BooleanThe current directory being displayed.
pwd: Stringconst path = FileManager.bookmarkedPath('Shortcuts')
const browser = new FileBrowser(path)
const file = await browser.present()const {FileBrowser} = importModule('file-browser')
const path = '/Developer'
const browser = new FileBrowser(path)
const file = await browser.present()const {FileBrowser} = importModule('file-browser')
const path = '/Developer'
const browser = new FileBrowser(path, {precheckAccess:false})
const file = await browser.present()