Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Boris Kocherov
jio
Commits
335af6dd
Commit
335af6dd
authored
11 years ago
by
Tristan Cavelier
Browse files
Options
Download
Email Patches
Plain Diff
jIO.util two tools added for blob manipulation
parent
308876d2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
src/jio/core/util.js
src/jio/core/util.js
+20
-0
No files found.
src/jio/core/util.js
View file @
335af6dd
...
@@ -319,6 +319,26 @@ function readBlobAsBinaryString(blob) {
...
@@ -319,6 +319,26 @@ function readBlobAsBinaryString(blob) {
}
}
exports
.
util
.
readBlobAsBinaryString
=
readBlobAsBinaryString
;
exports
.
util
.
readBlobAsBinaryString
=
readBlobAsBinaryString
;
function
readBlobAsArrayBuffer
(
blob
)
{
var
deferred
=
new
Deferred
(),
fr
=
new
FileReader
();
fr
.
onload
=
deferred
.
resolve
.
bind
(
deferred
);
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
readAsArrayBuffer
(
blob
);
return
deferred
.
promise
();
}
exports
.
util
.
readBlobAsArrayBuffer
=
readBlobAsArrayBuffer
;
function
readBlobAsText
(
blob
)
{
var
deferred
=
new
Deferred
(),
fr
=
new
FileReader
();
fr
.
onload
=
deferred
.
resolve
.
bind
(
deferred
);
fr
.
onerror
=
deferred
.
reject
.
bind
(
deferred
);
fr
.
onprogress
=
deferred
.
notify
.
bind
(
deferred
);
fr
.
readAsText
(
blob
);
return
deferred
.
promise
();
}
exports
.
util
.
readBlobAsText
=
readBlobAsText
;
/**
/**
* Send request with XHR and return a promise. xhr.onload: The promise is
* Send request with XHR and return a promise. xhr.onload: The promise is
* resolve when the status code is lower than 400 with the xhr object as first
* resolve when the status code is lower than 400 with the xhr object as first
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment