- Overview
- The Command-line Interface
- Platform Guides
- The config.xml File
- Embedding WebViews
- Plugin Development Guide
- Privacy Guide
- Whitelist Guide
- Accelerometer
- Camera
- Capture
- Compass
- Connection
- Contacts
- Device
- Events
- File
- Geolocation
- Globalization
- InAppBrowser
- Media
- Notification
- Splashscreen
- Storage
File
This object contains attributes of a single file.
Properties
-
name: The name of the file. (DOMString)
-
fullPath: The full path of the file including the file name. (DOMString)
-
type: The mime type of the file. (DOMString)
-
lastModifiedDate: The last time the file was modified. (Date)
-
size: The size of the file in bytes. (long)
Methods
- slice: Select only a portion of the file to be read.
Details
The File
object contains attributes of a single file. You can get
an instance of a File
object by calling a [FileEntry](../fileentry/fileentry.html)
object's
file()
method.
Supported Platforms
- Android
- BlackBerry WebWorks (OS 5.0 and higher)
- iOS
- Windows Phone 7 and 8
- Windows 8
slice
Return a new File
object, for which [FileReader](../filereader/filereader.html)
returns only the
specified portion of the file. Negative values for start
or end
are measured from the end of the file. Indexes are positioned
relative to the current slice. (See the full example below.)
Parameters:
-
start: The index of the first byte to read, inclusive.
-
end: The index of the byte after the last one to read.
Quick Example
var slicedFile = file.slice(10, 30);
Full Example
var slice1 = file.slice(100, 400);
var slice2 = slice1.slice(20, 35);
var slice3 = file.slice(120, 135);
// slice2 and slice3 are equivalent.
Supported Platforms
- Android
- iOS