Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Yaxel Perez
jio
Commits
f8d06159
Commit
f8d06159
authored
Jul 02, 2018
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[util] Add base64toBlob function
parent
7abe77f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
src/jio.js
src/jio.js
+28
-0
No files found.
src/jio.js
View file @
f8d06159
...
@@ -188,6 +188,34 @@
...
@@ -188,6 +188,34 @@
util
.
dataURItoBlob
=
dataURItoBlob
;
util
.
dataURItoBlob
=
dataURItoBlob
;
function
base64toBlob
(
b64Data
,
contentType
,
sliceSize
)
{
contentType
=
contentType
||
''
;
sliceSize
=
sliceSize
||
512
;
var
byteCharacters
=
window
.
atob
(
b64Data
),
byteArrays
=
[],
slice
,
byteArray
,
byteNumbers
=
[],
offset
,
i
;
for
(
offset
=
0
;
offset
<
byteCharacters
.
length
;
offset
+=
sliceSize
)
{
slice
=
byteCharacters
.
slice
(
offset
,
offset
+
sliceSize
);
for
(
i
=
0
;
i
<
slice
.
length
;
i
+=
1
)
{
byteNumbers
[
i
]
=
slice
.
charCodeAt
(
i
);
}
byteArray
=
new
Uint8Array
(
byteNumbers
);
byteArrays
.
push
(
byteArray
);
}
return
new
Blob
(
byteArrays
,
{
type
:
contentType
});
}
util
.
base64toBlob
=
base64toBlob
;
// tools
// tools
function
checkId
(
argument_list
,
storage
,
method_name
)
{
function
checkId
(
argument_list
,
storage
,
method_name
)
{
if
(
typeof
argument_list
[
0
]
!==
'
string
'
||
argument_list
[
0
]
===
''
)
{
if
(
typeof
argument_list
[
0
]
!==
'
string
'
||
argument_list
[
0
]
===
''
)
{
...
...
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