mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 10:04:33 +02:00
base64 encoding before passing file to IPC
This commit is contained in:
parent
8200af1d99
commit
d843e716b7
|
@ -549,8 +549,8 @@ ipcMain.on('save-file-to-folder',(event,data)=>{
|
|||
console.log(data.file)
|
||||
|
||||
try {
|
||||
|
||||
let buffer = Buffer.from(data.file);
|
||||
|
||||
let buffer = Buffer.from(atob(data.file));
|
||||
let arraybuffer = Uint8Array.from(buffer);
|
||||
console.log(arraybuffer)
|
||||
fs.writeFile(filepath.filePath, data.file, 'binary', function (err, data) {
|
||||
|
|
|
@ -861,8 +861,9 @@ function saveFileToFolder(id) {
|
|||
console.log(data.length)
|
||||
//data = new Blob([data.buffer], { type: 'image/png' } /* (1) */)
|
||||
console.log(data)
|
||||
// we need to encode data because of error "an object could not be cloned"
|
||||
let Data = {
|
||||
file: data,
|
||||
file: btoa(data),
|
||||
filename: filename,
|
||||
filetype: filetype,
|
||||
}
|
||||
|
@ -878,7 +879,7 @@ function saveFileToFolder(id) {
|
|||
}
|
||||
|
||||
|
||||
// function for setting an ICON to the correspinding state
|
||||
// function for setting an ICON to the corresponding state
|
||||
function get_icon_for_state(state) {
|
||||
if (state == 'transmit') {
|
||||
var status_icon = '<i class="bi bi-check" style="font-size:1rem;"></i>';
|
||||
|
|
Loading…
Reference in a new issue