Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Latest commit

 

History

History
334 lines (193 loc) · 9.78 KB

INativeFileAccess.md

File metadata and controls

334 lines (193 loc) · 9.78 KB

@js-soft/native-abstractions / Exports / INativeFileAccess

Interface: INativeFileAccess

Access the native filesystem (read/write)

Table of contents

Methods

Methods

createDirectory

createDirectory(path, storage?): Promise<Result<void, ApplicationError>>

Create a directory

Parameters

Name Type Description
path string path of the directory relative to the storage
storage? NativeFileStorage storage location of the directory

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeFileAccess.ts:158


deleteDirectory

deleteDirectory(path, storage?): Promise<Result<void, ApplicationError>>

Delete a directory

Parameters

Name Type Description
path string path of the directory relative to the storage
storage? NativeFileStorage storage location of the directory

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeFileAccess.ts:164


deleteFile

deleteFile(path, storage?): Promise<Result<void, ApplicationError>>

Delete specified file

Parameters

Name Type Description
path string path to the file relative to the storage
storage? NativeFileStorage storage location of the file

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeFileAccess.ts:140


existsDirectory

existsDirectory(path, storage?): Promise<Result<boolean, ApplicationError>>

Test if a directory exists

Parameters

Name Type Description
path string path of the directory relative to the storage
storage? NativeFileStorage storage location of the directory

Returns

Promise<Result<boolean, ApplicationError>>

Defined in

src/INativeFileAccess.ts:170


existsFile

existsFile(path, storage?): Promise<Result<boolean, ApplicationError>>

Test if a file exists

Parameters

Name Type Description
path string path to the file relative to the storage
storage? NativeFileStorage storage location of the file

Returns

Promise<Result<boolean, ApplicationError>>

Defined in

src/INativeFileAccess.ts:146


infoDirectory

infoDirectory(path, storage?): Promise<Result<INativeDirectory, ApplicationError>>

Retrieve information about a specified directory

Parameters

Name Type Description
path string path of the directory relative to the storage
storage? NativeFileStorage storage location of the directory

Returns

Promise<Result<INativeDirectory, ApplicationError>>

Defined in

src/INativeFileAccess.ts:152


infoFile

infoFile(path, storage?): Promise<Result<INativeFileMetadata, ApplicationError>>

Retrieve meta information about the specified file

Parameters

Name Type Description
path string path to the file relative to the storage
storage? NativeFileStorage storage location of the file

Returns

Promise<Result<INativeFileMetadata, ApplicationError>>

Defined in

src/INativeFileAccess.ts:114


init

init(): Promise<Result<void, ApplicationError>>

Initialize the native features and create a folder structure

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeFileAccess.ts:190


openFile

openFile(path, storage?): Promise<Result<void, ApplicationError>>

Open a file with the standard application specified by the operating system

Parameters

Name Type Description
path string path to the file relative to the storage
storage? NativeFileStorage storage location of the file

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeFileAccess.ts:180


openFileContent

openFileContent(content, metadata): Promise<Result<void, ApplicationError>>

Create and open a file with the standard application specified by the operating system

Parameters

Name Type Description
content Uint8Array content of the file
metadata INativeFileMetadata metadata of the file

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeFileAccess.ts:186


readFileAsBinary

readFileAsBinary(path, storage?): Promise<Result<Uint8Array, ApplicationError>>

Read the data of the specified file as a an array

Parameters

Name Type Description
path string path to the file relative to the storage
storage? NativeFileStorage storage location of the file

Returns

Promise<Result<Uint8Array, ApplicationError>>

Defined in

src/INativeFileAccess.ts:126


readFileAsText

readFileAsText(path, storage?): Promise<Result<string, ApplicationError>>

Read the data of the specified file as a string

Parameters

Name Type Description
path string path to the file relative to the storage
storage? NativeFileStorage storage location of the file

Returns

Promise<Result<string, ApplicationError>>

Defined in

src/INativeFileAccess.ts:120


select

select(): Promise<Result<INativeFile, ApplicationError>>

Open the file selection dialog of the operating system and receive the selected file

Returns

Promise<Result<INativeFile, ApplicationError>>

Defined in

src/INativeFileAccess.ts:174


writeFile

writeFile(path, data, storage?, append?): Promise<Result<void, ApplicationError>>

Write data to a file

Parameters

Name Type Description
path string path to the file relative to the storage
data string | Uint8Array data to write to the file
storage? NativeFileStorage storage location of the file
append? boolean overwrite file or append data on the end of the file

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeFileAccess.ts:134