MCPcopy Create free account
hub / github.com/Hattorius/CipherDrop / handleFile

Function handleFile

frontend/file.js:85–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83
84
85const handleFile = async bytes => {
86 state = 1;
87 currentProgress = 80;
88
89 if (file === null) {
90 file = await decryptFile(
91 bytes,
92 key,
93 iv,
94 mimeType,
95 fileName
96 );
97 }
98
99 const url = URL.createObjectURL(file);
100
101 const a = document.createElement('a');
102 a.href = url;
103 a.download = file.name;
104 a.style.display = 'none';
105 a.onclick = () => {
106 console.log('hi');
107 URL.revokeObjectURL(url)
108 };
109
110 success();
111
112 setTimeout(() => {
113 a.click();
114 }, 350);
115}
116
117const base64UrlToArrayBuffer = string => {
118 const base64String = string.replace(/-/g, '+').replace(/_/g, '/');

Callers 1

file.jsFile · 0.70

Calls 2

decryptFileFunction · 0.85
successFunction · 0.85

Tested by

no test coverage detected