Interface IOHelper

Utility class for easy access to operations on application folders

Index

Methods

Methods

public exists(filename: string): Promise

Determines whether the specified file exists in the folder.

Parameters

  • filename: string

    The name of the file.

Returns

Promise

A promise that completes with a value of either true (if the file exists) or false.

public readText(fileName: string, def?: string): Promise

Reads the specified file. If the file doesn't exist, the specified default value is returned.

Parameters

  • fileName: string

    The file to read from.

  • def?: string optional

    The default value to be returned if the file failed to open.

Returns

Promise

A promise that completes with a value that is either the contents of the file, or the specified default value.

public remove(fileName: string): Promise

Deletes a file from the folder.

Parameters

  • fileName: string

    The file to be deleted.

Returns

Promise

A promise that is fulfilled when the file has been deleted.

public writeText(fileName: string, text: string): Promise

Writes the specified text to the specified file.

Parameters

  • fileName: string

    The name of the file.

  • text: string

    The content to be written to the file.

Returns

Promise

A promise that completes with a value that is the number of characters written.