Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
330690a
screen reader
imhoffd Dec 14, 2020
c369ada
action sheet
imhoffd Dec 14, 2020
bdac5e9
more screen reader
imhoffd Dec 14, 2020
b55bcfb
wip
imhoffd Dec 14, 2020
aa4df2b
export all from definitions
imhoffd Dec 14, 2020
69afc8d
motion
imhoffd Dec 14, 2020
88db6f3
toast
imhoffd Dec 14, 2020
f8d2b7b
haptics
imhoffd Dec 14, 2020
8a3700f
more screen reader
imhoffd Dec 14, 2020
4bdd07f
app
imhoffd Dec 14, 2020
d9d6a1d
network
imhoffd Dec 14, 2020
c6dd1fe
app-launcher
imhoffd Dec 14, 2020
c35e73a
wip
imhoffd Dec 14, 2020
3a7e9d3
filesystem
imhoffd Dec 14, 2020
7b91694
browser
imhoffd Dec 14, 2020
6c270e9
text-zoom
imhoffd Dec 14, 2020
90e93f6
status-bar
imhoffd Dec 14, 2020
27410cb
device
imhoffd Dec 14, 2020
682d023
clipboard
imhoffd Dec 14, 2020
b8ee00b
Merge remote-tracking branch 'origin/main' into localize-types
imhoffd Dec 14, 2020
f53c9f1
generate readmes
imhoffd Dec 14, 2020
8a04441
fmt
imhoffd Dec 14, 2020
4b45c36
Merge branch 'main' into localize-types
imhoffd Dec 15, 2020
a502574
update docgen
imhoffd Dec 15, 2020
4a38e02
regen
imhoffd Dec 15, 2020
f082233
Merge branch 'main' into localize-types
imhoffd Dec 16, 2020
5c294cd
Merge branch 'main' into localize-types
imhoffd Dec 16, 2020
4a7205d
Merge branch 'main' into localize-types
imhoffd Dec 19, 2020
a61781e
Merge branch 'main' into localize-types
imhoffd Dec 19, 2020
fbddd6b
geolocation
imhoffd Dec 20, 2020
45c69ac
camera
imhoffd Dec 20, 2020
c57d3fd
splash-screen
imhoffd Dec 20, 2020
ed46fd9
build and format
imhoffd Dec 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
filesystem
  • Loading branch information
imhoffd committed Dec 14, 2020
commit 3a7e9d3a89a6506207a5dc97ff99d41b445c6591
138 changes: 95 additions & 43 deletions filesystem/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface PermissionStatus {
publicStorage: PermissionState;
}

export enum FilesystemDirectory {
export enum Directory {
/**
* The Documents directory
* On iOS it's the app's documents directory.
Expand Down Expand Up @@ -61,7 +61,7 @@ export enum FilesystemDirectory {
ExternalStorage = 'EXTERNAL_STORAGE',
}

export enum FilesystemEncoding {
export enum Encoding {
/**
* Eight-bit UCS Transformation Format
*
Expand All @@ -88,7 +88,7 @@ export enum FilesystemEncoding {
UTF16 = 'utf16',
}

export interface FileWriteOptions {
export interface WriteFileOptions {
/**
* The path of the file to write
*
Expand All @@ -104,21 +104,21 @@ export interface FileWriteOptions {
data: string;

/**
* The FilesystemDirectory to store the file in
* The `Directory` to store the file in
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;

/**
* The encoding to write the file in. If not provided, data
* is written as base64 encoded.
*
* Pass FilesystemEncoding.UTF8 to write data as string
* Pass Encoding.UTF8 to write data as string
*
* @since 1.0.0
*/
encoding?: FilesystemEncoding;
encoding?: Encoding;

/**
* Whether to create any missing parent directories.
Expand All @@ -129,7 +129,7 @@ export interface FileWriteOptions {
recursive?: boolean;
}

export interface FileAppendOptions {
export interface AppendFileOptions {
/**
* The path of the file to append
*
Expand All @@ -145,11 +145,11 @@ export interface FileAppendOptions {
data: string;

/**
* The FilesystemDirectory to store the file in
* The `Directory` to store the file in
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;

/**
* The encoding to write the file in. If not provided, data
Expand All @@ -159,10 +159,10 @@ export interface FileAppendOptions {
*
* @since 1.0.0
*/
encoding?: FilesystemEncoding;
encoding?: Encoding;
}

export interface FileReadOptions {
export interface ReadFileOptions {
/**
* The path of the file to read
*
Expand All @@ -171,24 +171,24 @@ export interface FileReadOptions {
path: string;

/**
* The FilesystemDirectory to read the file from
* The `Directory` to read the file from
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;

/**
* The encoding to read the file in, if not provided, data
* is read as binary and returned as base64 encoded.
*
* Pass FilesystemEncoding.UTF8 to read data as string
* Pass Encoding.UTF8 to read data as string
*
* @since 1.0.0
*/
encoding?: FilesystemEncoding;
encoding?: Encoding;
}

export interface FileDeleteOptions {
export interface DeleteFileOptions {
/**
* The path of the file to delete
*
Expand All @@ -197,11 +197,11 @@ export interface FileDeleteOptions {
path: string;

/**
* The FilesystemDirectory to delete the file from
* The `Directory` to delete the file from
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;
}

export interface MkdirOptions {
Expand All @@ -213,11 +213,11 @@ export interface MkdirOptions {
path: string;

/**
* The FilesystemDirectory to make the new directory in
* The `Directory` to make the new directory in
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;

/**
* Whether to create any missing parent directories as well.
Expand All @@ -237,11 +237,11 @@ export interface RmdirOptions {
path: string;

/**
* The FilesystemDirectory to remove the directory from
* The `Directory` to remove the directory from
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;

/**
* Whether to recursively remove the contents of the directory
Expand All @@ -261,11 +261,11 @@ export interface ReaddirOptions {
path: string;

/**
* The FilesystemDirectory to list files from
* The `Directory` to list files from
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;
}

export interface GetUriOptions {
Expand All @@ -277,11 +277,11 @@ export interface GetUriOptions {
path: string;

/**
* The FilesystemDirectory to get the file under
* The `Directory` to get the file under
*
* @since 1.0.0
*/
directory: FilesystemDirectory;
directory: Directory;
}

export interface StatOptions {
Expand All @@ -293,11 +293,11 @@ export interface StatOptions {
path: string;

/**
* The FilesystemDirectory to get the file under
* The `Directory` to get the file under
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;
}

export interface CopyOptions {
Expand All @@ -316,39 +316,41 @@ export interface CopyOptions {
to: string;

/**
* The FilesystemDirectory containing the existing file or directory
* The `Directory` containing the existing file or directory
*
* @since 1.0.0
*/
directory?: FilesystemDirectory;
directory?: Directory;

/**
* The FilesystemDirectory containing the destination file or directory. If not supplied will use the 'directory'
* The `Directory` containing the destination file or directory. If not supplied will use the 'directory'
* parameter as the destination
*
* @since 1.0.0
*/
toDirectory?: FilesystemDirectory;
toDirectory?: Directory;
}

export type RenameOptions = CopyOptions;

export interface FileReadResult {
export interface ReadFileResult {
/**
* The string representation of the data contained in the file
*
* @since 1.0.0
*/
data: string;
}
export interface FileWriteResult {

export interface WriteFileResult {
/**
* The uri where the file was written into
*
* @since 1.0.0
*/
uri: string;
}

export interface ReaddirResult {
/**
* List of files and directories inside the directory
Expand All @@ -357,6 +359,7 @@ export interface ReaddirResult {
*/
files: string[];
}

export interface GetUriResult {
/**
* The uri of the file
Expand All @@ -365,6 +368,7 @@ export interface GetUriResult {
*/
uri: string;
}

export interface StatResult {
/**
* Type of the file
Expand Down Expand Up @@ -408,28 +412,28 @@ export interface FilesystemPlugin {
*
* @since 1.0.0
*/
readFile(options: FileReadOptions): Promise<FileReadResult>;
readFile(options: ReadFileOptions): Promise<ReadFileResult>;

/**
* Write a file to disk in the specified location on device
*
* @since 1.0.0
*/
writeFile(options: FileWriteOptions): Promise<FileWriteResult>;
writeFile(options: WriteFileOptions): Promise<WriteFileResult>;

/**
* Append to a file on disk in the specified location on device
*
* @since 1.0.0
*/
appendFile(options: FileAppendOptions): Promise<void>;
appendFile(options: AppendFileOptions): Promise<void>;

/**
* Delete a file from disk
*
* @since 1.0.0
*/
deleteFile(options: FileDeleteOptions): Promise<void>;
deleteFile(options: DeleteFileOptions): Promise<void>;

/**
* Create a directory.
Expand Down Expand Up @@ -482,19 +486,67 @@ export interface FilesystemPlugin {

/**
* Check read/write permissions.
* Required on Android, only when using FilesystemDirectory.Documents or
* FilesystemDirectory.ExternalStorage.
* Required on Android, only when using `Directory.Documents` or
* `Directory.ExternalStorage`.
*
* @since 1.0.0
*/
checkPermissions(): Promise<PermissionStatus>;

/**
* Request read/write permissions.
* Required on Android, only when using FilesystemDirectory.Documents or
* FilesystemDirectory.ExternalStorage.
* Required on Android, only when using `Directory.Documents` or
* `Directory.ExternalStorage`.
*
* @since 1.0.0
*/
requestPermissions(): Promise<PermissionStatus>;
}

/**
* @deprecated Use `ReadFileOptions`.
* @since 1.0.0
*/
export type FileReadOptions = ReadFileOptions;

/**
* @deprecated Use `ReadFileResult`.
* @since 1.0.0
*/
export type FileReadResult = ReadFileResult;

/**
* @deprecated Use `WriteFileOptions`.
* @since 1.0.0
*/
export type FileWriteOptions = WriteFileOptions;

/**
* @deprecated Use `WriteFileResult`.
* @since 1.0.0
*/
export type FileWriteResult = WriteFileResult;

/**
* @deprecated Use `AppendFileOptions`.
* @since 1.0.0
*/
export type FileAppendOptions = AppendFileOptions;

/**
* @deprecated Use `DeleteFileOptions`.
* @since 1.0.0
*/
export type FileDeleteOptions = DeleteFileOptions;

/**
* @deprecated Use `Directory`.
* @since 1.0.0
*/
export const FilesystemDirectory = Directory;

/**
* @deprecated Use `Encoding`.
* @since 1.0.0
*/
export const FilesystemEncoding = Encoding;
Loading