You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/03/04 23:34:31 UTC
docs commit: Docs for readAsBinaryString and readAsArrayBuffer
Updated Branches:
refs/heads/master f24e0a991 -> c281ed288
Docs for readAsBinaryString and readAsArrayBuffer
Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/c281ed28
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/c281ed28
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/c281ed28
Branch: refs/heads/master
Commit: c281ed288b99c70eff5fa2eb6c3a25d5c4361b56
Parents: f24e0a9
Author: Braden Shepherdson <br...@gmail.com>
Authored: Mon Mar 4 17:34:07 2013 -0500
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Mon Mar 4 17:34:07 2013 -0500
----------------------------------------------------------------------
docs/en/edge/cordova/file/filereader/filereader.md | 62 ++++++++++++++-
1 files changed, 60 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c281ed28/docs/en/edge/cordova/file/filereader/filereader.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/file/filereader/filereader.md b/docs/en/edge/cordova/file/filereader/filereader.md
index 136e26d..f9126d3 100644
--- a/docs/en/edge/cordova/file/filereader/filereader.md
+++ b/docs/en/edge/cordova/file/filereader/filereader.md
@@ -38,9 +38,11 @@ Properties
Methods
-------
-- __abort__: Aborts reading file.
+- __abort__: Aborts reading file.
- __readAsDataURL__: Read file and return data as a base64 encoded data url.
- __readAsText__: Reads text file.
+- __readAsBinaryString__: Reads file as binary and returns a binary string.
+- __readAsArrayBuffer__: Reads file as an ArrayBuffer.
Details
-------
@@ -194,4 +196,60 @@ Full Example
iOS Quirks
----------
-- __encoding__ parameter is not supported, UTF8 encoding is always used.
\ No newline at end of file
+- __encoding__ parameter is not supported, UTF8 encoding is always used.
+
+Read As Binary String
+---------------------
+
+Currently supported on iOS and Android only.
+
+__Parameters:__
+- file - the file object to read
+
+
+Quick Example
+-------------
+
+ function win(file) {
+ var reader = new FileReader();
+ reader.onloadend = function(evt) {
+ console.log("read success");
+ console.log(evt.target.result);
+ };
+ reader.readAsBinaryString(file);
+ };
+
+ var fail = function(evt) {
+ console.log(error.code);
+ };
+
+ entry.file(win, fail);
+
+
+Read As Array Buffer
+--------------------
+
+Currently supported on iOS and Android only.
+
+__Parameters:__
+- file - the file object to read
+
+
+Quick Example
+-------------
+
+ function win(file) {
+ var reader = new FileReader();
+ reader.onloadend = function(evt) {
+ console.log("read success");
+ console.log(new Uint8Array(evt.target.result));
+ };
+ reader.readAsArrayBuffer(file);
+ };
+
+ var fail = function(evt) {
+ console.log(error.code);
+ };
+
+ entry.file(win, fail);
+