import { InjectionToken } from '@angular/core';
import * as i0 from "@angular/core";
/**
* Optional options available when saving to a file.
*/
export interface SaveOptions {
/**
* Mime type of the saved file.
*/
mimeType?: string;
/**
* Character encoding to set as metadata when saving the file. Defaults to
* `utf-8`.
*/
charset?: string;
/**
* Whether to automatically add an UTF BOM.
*/
autoBOM?: boolean;
}
/**
* Optional options available when loading from a file.
*/
export interface LoadOptions {
/**
* Accepted type of files (used by the `` element).
*/
accept?: string;
/**
* Character encoding used by the file to load.
*/
charset?: string;
}
/**
* Injection token to specify the amount of milliseconds after a window focus
* that we wait for a change event on the file input to occur before we consider
* that the user has cancelled the loading.
*/
export declare const LF_WAIT_BEFORE_DETECT_CANCEL: InjectionToken;
/**
* Service used to interact with the user's file system in order to save or load
* files. This service does not depend on anything LF related but is used by LF
* to save/load application state.
*/
export declare class FileSystemService {
private waitBeforeDetectCancel;
/**
* Default amount of milliseconds after a window focus that we wait for a
* change event on the file input to occur before we consider that the user
* has cancelled the loading.
*/
static DEFAULT_WAIT_BEFORE_DETECT_CANCEL: number;
protected _fileInput: HTMLInputElement;
protected _reader: FileReader;
protected _loadCharset: string;
protected _loadResolve?: (fileContent: string | null) => void;
protected _loadReject?: (error: Error) => void;
private _cancelTimeout?;
constructor(waitBeforeDetectCancel?: number | null);
/**
* Whether the current browser supports saving to a file (IE<=9 is not
* supported).
*/
get saveIsSupported(): boolean;
/**
* Whether the current browser supports loading from a file.
*/
get loadIsSupported(): boolean;
/**
* Saves the provided content into a file. Does not support IE<=9.
* @param content Content to save to file.
* @param fileName Name of the file to save.
* @param options Options used to save the file.
* @returns A promise which resolves once the file has been saved.
*/
save(content: BlobPart[], fileName: string, { mimeType, charset, autoBOM, }?: SaveOptions): Promise;
/**
* Triggers a file picker to choose a file to be loaded.
* @param options Options to load from a file.
* @returns Promise which resolves with the content of the file once the file
* has finished loading or `null` if the user cancelled the action.
*/
load({ accept, charset, }?: LoadOptions): Promise;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵprov: i0.ɵɵInjectableDeclaration;
}