File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export function downloadPNG ( imgURL ) {
2+ const url = window . URL . createObjectURL ( new Blob ( [ imgURL ] ) ) ;
3+ const link = document . createElement ( "a" ) ;
4+ link . href = url ;
5+ link . setAttribute ( "download" , "qrCode.png" ) ; //or any other extension
6+ document . body . appendChild ( link ) ;
7+ link . click ( ) ;
8+ }
9+
10+ export function downloadSVG ( imgURL ) {
11+ const url = window . URL . createObjectURL ( new Blob ( [ imgURL ] ) ) ;
12+ const link = document . createElement ( "a" ) ;
13+ link . href = url ;
14+ link . setAttribute ( "download" , "qrCode.svg" ) ; //or any other extension
15+ document . body . appendChild ( link ) ;
16+ link . click ( ) ;
17+ }
18+
19+ export function downloadJPG ( imgURL ) {
20+ const url = window . URL . createObjectURL ( new Blob ( [ imgURL ] ) ) ;
21+ const link = document . createElement ( "a" ) ;
22+ link . href = url ;
23+ link . setAttribute ( "download" , "qrCode.jpg" ) ; //or any other extension
24+ document . body . appendChild ( link ) ;
25+ link . click ( ) ;
26+ }
27+
You can’t perform that action at this time.
0 commit comments