new FileReader()
This class reads the mobile device file system.
For Android:
The root directory is the root of the file system.
To read from the SD card, the file name is "sdcard/my_file.txt"
Members
(static) READ_CHUNK_SIZE
Defines the maximum size to read at a time via the native API. The default value is a compromise between
minimizing the overhead of many exec() calls while still reporting progress frequently enough for large files.
(Note attempts to allocate more than a few MB of contiguous memory on the native side are likely to cause
OOM exceptions, while the JS engine seems to have fewer problems managing large strings or ArrayBuffers.)
Methods
abort()
Abort reading file.
readAsArrayBuffer(file)
Read file and return data as a binary data.
Parameters:
Name | Type | Description |
---|---|---|
file |
File | File object containing file properties |
readAsBinaryString(file)
Read file and return data as a binary data.
Parameters:
Name | Type | Description |
---|---|---|
file |
File | File object containing file properties |
readAsDataURL(file)
Read file and return data as a base64 encoded data url.
A data url is of the form:
data:[][;base64],
Parameters:
Name | Type | Description |
---|---|---|
file |
File | File object containing file properties |
readAsText(file, encoding)
Read text file.
Parameters:
Name | Type | Description |
---|---|---|
file |
File | File object containing file properties |
encoding |
[Optional] (see http://www.iana.org/assignments/character-sets) |