回答編集履歴

3

chousei

2021/04/20 08:44

投稿

yambejp
yambejp

スコア116443

test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  const bin = atob(data.replace(/^.*,/, ''));
10
10
 
11
- const buffer = new Uint8Array(bin.length).map((x,y)=>bin.charCodeAt(y));
11
+ const buffer = new Uint8Array(bin.length).map((_,x)=>bin.charCodeAt(x));
12
12
 
13
13
  const blob = new Blob([buffer.buffer], {type});
14
14
 

2

chousei

2021/04/20 08:44

投稿

yambejp
yambejp

スコア116443

test CHANGED
@@ -8,13 +8,7 @@
8
8
 
9
9
  const bin = atob(data.replace(/^.*,/, ''));
10
10
 
11
- const buffer = new Uint8Array(bin.length);
11
+ const buffer = new Uint8Array(bin.length).map((x,y)=>bin.charCodeAt(y));
12
-
13
- for (var i = 0; i < bin.length; i++) {
14
-
15
- buffer[i] = bin.charCodeAt(i);
16
-
17
- }
18
12
 
19
13
  const blob = new Blob([buffer.buffer], {type});
20
14
 

1

chousei

2021/04/20 08:43

投稿

yambejp
yambejp

スコア116443

test CHANGED
@@ -1,6 +1,6 @@
1
1
  ```javascript
2
2
 
3
- let data = "data:image/jpeg;base64,/***"
3
+ let data="data:image/gif;base64,R0lGODdhEAAQAIACAAUFBfr6+iwAAAAAEAAQAAACJoyPqcsIrV6QE1hbscSGzl4dXJiJ1HM66ua1nPclG9ixNgzl+s4XADs=";
4
4
 
5
5
  const filename="test.gif";
6
6