File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright © Magento, Inc. All rights reserved.
3
+ * See COPYING.txt for license details.
4
+ */
5
+ define ( [
6
+ 'jquery'
7
+ ] , function ( $ ) {
8
+ 'use strict' ;
9
+
10
+ /**
11
+ * Init "readAsBinaryString" function for FileReader class.
12
+ * It need for IE11
13
+ * @param {Blob } fileData
14
+ */
15
+ var readAsBinaryStringIEFunc = function ( fileData ) {
16
+ var binary = '' ,
17
+ self = this ,
18
+ reader = new FileReader ( ) ;
19
+
20
+ /**
21
+ * Read file as binary string
22
+ */
23
+ reader . onload = function ( ) {
24
+ var bytes , length , index ;
25
+
26
+ bytes = new Uint8Array ( reader . result ) ;
27
+ length = bytes . length ;
28
+
29
+ for ( index = 0 ; index < length ; index ++ ) {
30
+ binary += String . fromCharCode ( bytes [ index ] ) ;
31
+ }
32
+ //self.result - readonly so assign binary
33
+ self . content = binary ;
34
+ $ ( self ) . trigger ( 'onload' ) ;
35
+ } ;
36
+ reader . readAsArrayBuffer ( fileData ) ;
37
+ } ;
38
+
39
+ if ( typeof FileReader . prototype . readAsBinaryString === 'undefined' ) {
40
+ FileReader . prototype . readAsBinaryString = readAsBinaryStringIEFunc ;
41
+ }
42
+ } ) ;
You can’t perform that action at this time.
0 commit comments