joplin-notes/joplin notion extension/Web Development/Javascript/File handling.md
2026-11-04 00:33:23 +05:30

14 lines
No EOL
495 B
Markdown

File handling
- Client(browser)
```jsx
const encryptedFileInput = document.getElementById("encryptedFileInput");
const encryptedFile = encryptedFileInput.files[0];
// Read the encrypted file
const encryptedData = await encryptedFile.arrayBuffer();
```
- arrayBuffer vs blob
blob is immutable and is the data type when we submit the file in form in client(browser)
arraybuffer is the binary representation of file as thats how `fs.readFileSync` returns it