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

278 Views Asked by At

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?.

1

There are 1 best solutions below

2
Kaiido On BEST ANSWER

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