@ply-ct/ply
Version:
REST API Automated Testing
61 lines (60 loc) • 1.78 kB
TypeScript
import { Location } from './location';
/**
* Abstracts storage to file system or html localStorage.
* TODO: rename Storage to SyncStorage, and this to Storage,
* and phase out SyncStorage.
*/
export declare class AsyncStorage {
readonly location: Location;
private readonly localStorage;
/**
* @param location file or logical path
*/
constructor(location: string);
exists(): Promise<boolean>;
read(): Promise<string | undefined>;
/**
* For file system storage, all newlines are replaced with OS-appropriate
*/
write(contents: string): Promise<void>;
/**
* For file system storage, all newlines are replaced with OS-appropriate
*/
append(contents: string): Promise<void>;
insert(contents: string, start: number): Promise<void>;
padLines(start: number, lines: number): Promise<void>;
clear(): Promise<void>;
remove(): Promise<void>;
/**
* TODO local storage
*/
mkdir(): Promise<void>;
toString(): string;
}
/**
* Abstracts storage to file system or html localStorage.
*/
export declare class Storage {
readonly location: Location;
private readonly localStorage;
/**
* @param location file or logical path
*/
constructor(location: string);
get exists(): boolean;
read(): string | undefined;
/**
* For file system storage, all newlines are replaced with OS-appropriate
*/
write(contents: string): void;
/**
* For file system storage, all newlines are replaced with OS-appropriate
*/
append(contents: string): void;
insert(contents: string, start: number): void;
padLines(start: number, lines: number): void;
clear(): void;
remove(): void;
mkdir(): void;
toString(): string;
}