Class: JsLocalStorageFile

JsLocalStorageFile(path)

Salmon localStorage implementation. This can be used to store small files.

Constructor

new JsLocalStorageFile(path)

Instantiate a real file represented by the filepath provided.
Parameters:
Name Type Description
path The filepath.
Source:

Classes

JsLocalStorageFile

Methods

(async) copy(newDir, newName, progressListener)

Move this file or directory under a new directory.
Parameters:
Name Type Default Description
newDir The target directory.
newName null New filename
progressListener null Observer to notify when progress changes.
Source:
Throws:
IOException Thrown if there is an IO error.
Returns:
The copied file. Use this file for subsequent operations instead of the original.

(async) createDirectory(dirName)

Create a directory under this directory.
Parameters:
Name Type Description
dirName The name of the new directory.
Source:
Returns:
The newly created directory.

(async) createFile(filename)

Create a file under this directory.
Parameters:
Name Type Description
filename The name of the new file.
Source:
Throws:
IOException Thrown if there is an IO error.
Returns:
The newly created file.

(async) delete()

Delete this file or directory.
Source:
Returns:
True if deletion is successful.

(async) exists()

True if file or directory exists.
Source:
Returns:

getAbsolutePath()

Get the absolute path on the physical disk. For java this is the same as the filepath.
Source:
Returns:
The absolute path.

getBaseName()

Get the name of this file or directory.
Source:
Returns:
The name of this file or directory.

(async) getChild(filename)

Get the file or directory under this directory with the provided name.
Parameters:
Name Type Description
filename The name of the file or directory.
Source:
Returns:

(async) getChildrenCount()

Get the count of files and subdirectories
Source:
Returns:

(async) getInputStream()

Get a stream for reading the file.
Source:
Throws:
FileNotFoundException
Returns:
The stream to read from.

(async) getOutputStream()

Get a stream for writing to this file.
Source:
Throws:
FileNotFoundException
Returns:
The stream to write to.

(async) getParent()

Get the parent directory of this file or directory.
Source:
Returns:
The parent directory.

getPath()

Get the path of this file. For java this is the same as the absolute filepath.
Source:
Returns:

(async) isDirectory()

True if this is a directory.
Source:
Returns:

(async) isFile()

True if this is a file.
Source:
Returns:

(async) lastModified()

Get the last modified date on disk.
Source:
Returns:

(async) length()

Get the size of the file on disk.
Source:
Returns:

(async) listFiles()

List all files under this directory.
Source:
Returns:
The list of files.

(async) mkdir()

Create this directory under the current filepath.
Source:
Returns:
True if created.

(async) move(newDir, newName, progressListener)

Move this file or directory under a new directory.
Parameters:
Name Type Default Description
newDir The target directory.
newName null The new filename
progressListener null Observer to notify when progress changes.
Source:
Returns:
The moved file. Use this file for subsequent operations instead of the original.

(async) renameTo(newFilename)

Rename the current file or directory.
Parameters:
Name Type Description
newFilename The new name for the file or directory.
Source:
Returns:
True if successfully renamed.

toString()

Returns a string representation of this object
Source: