angularfile-system-access-api

File access system api(wicg-file-system-access) is not loading in dev environment


I am using wicg-file-system-access to access local files for my angular application, it works correctly on localhost but when i deploy changes to dev environment it is not working, i see window.showSaveFilePicker is undefined.

Is there any configuration that required for deployed site?.


Solution

  • Yes, you need a [SecureContext] (https:// or localhost).

    [SecureContext] // <-- This means it's only exposed in secure contexts
    partial interface Window {
        Promise<sequence<FileSystemFileHandle>> showOpenFilePicker(optional OpenFilePickerOptions options = {});
        Promise<FileSystemFileHandle> showSaveFilePicker(optional SaveFilePickerOptions options = {});
        Promise<FileSystemDirectoryHandle> showDirectoryPicker(optional DirectoryPickerOptions options = {});
    };