14 lines
No EOL
495 B
Markdown
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 |