On this page
Overview
Wraps the provider-owned native directory chooser and normalizes selected/cancelled/error results.
- Artifact
DirectoryPicker.js· esm - Classification
public first party - Availability
Native bridge - Normalization
Complete mutable caller options and provider result fields; coded cancellation and malformed-result errors.
Import and lifecycle
import * as module from '/arcane/modules/DirectoryPicker.js';
select opens one provider-owned operating-system directory chooser; it never enumerates directories, persists paths, or invokes a browser file picker.
Application-facing behavior: default DirectoryPicker, normalizeDirectoryPickerOptions(), normalizeDirectorySelection().
Protocol and host implementation
Arcane.filesystem.selectDirectory This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
default | default · class | class DirectoryPicker | — |
normalizeDirectoryPickerOptions | function | function normalizeDirectoryPickerOptions(input={}) | input={} |
normalizeDirectorySelection | function | function normalizeDirectorySelection(input) | input |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
normalizeDirectoryPickerOptions | exported-function | function normalizeDirectoryPickerOptions(input={}) | input={} |
normalizeDirectorySelection | exported-function | function normalizeDirectorySelection(input) | input |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
DirectoryPicker.constructor | constructor | constructor(provider=globalThis.Arcane?.filesystem) | provider=globalThis.Arcane?.filesystem |
DirectoryPicker.available | get | get available() | — |
DirectoryPicker.select | async method | async select(options={}) | options={} |
Parameter meanings and results
DirectoryPicker(provider).select(options) preserves every caller option, passes complete title and initialPath strings unchanged, and preserves every provider result field while normalizing cancelled and path. Returned option and result records remain mutable. normalizeDirectoryPickerOptions and normalizeDirectorySelection are public pure helpers.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
This artifact has no additional documented lifecycle event flow.
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- DIRECTORY_PICKER_UNAVAILABLE
- DIRECTORY_PICKER_INVALID_RESULT
- TypeError for non-object options or non-string title and initialPath values
Availability and capabilities
Native bridge. Complete mutable caller options and provider result fields; coded cancellation and malformed-result errors.
Normalized native Arcane.filesystem.selectDirectory wrapper, not a Core filesystem browser.
Contract example
import DirectoryPicker from '/arcane/modules/DirectoryPicker.js';
const picker=new DirectoryPicker({
selectDirectory:async options=>({cancelled:false,path:'/workspace'})
});
console.log(await picker.select({title:'Choose a workspace'}));