mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 10:04:33 +02:00
More atob/btoa fixes
This commit is contained in:
parent
c774e5a44f
commit
1bd01d7489
14
gui/main.js
14
gui/main.js
|
@ -507,7 +507,8 @@ console.log(filepath.filePaths[0])
|
|||
|
||||
try {
|
||||
//fs.readFile(filepath.filePaths[0], 'utf8', function (err, data) {
|
||||
fs.readFile(filepath.filePaths[0], 'binary', function (err, data) {
|
||||
//Has to be binary
|
||||
fs.readFile(filepath.filePaths[0],'binary', function (err, data) {
|
||||
|
||||
console.log(data.length)
|
||||
|
||||
|
@ -541,15 +542,10 @@ ipcMain.on('save-file-to-folder',(event,data)=>{
|
|||
console.log(data.file)
|
||||
|
||||
try {
|
||||
|
||||
let buffer = Buffer.from(data.file);
|
||||
let arraybuffer = Uint8Array.from(buffer);
|
||||
let arraybuffer = Buffer.from(data.file,"base64").toString('utf-8');
|
||||
console.log(arraybuffer)
|
||||
fs.writeFile(filepath.filePath, data.file, 'binary', function (err, data) {
|
||||
//fs.writeFile(filepath.filePath, arraybuffer, function (err, data) {
|
||||
//fs.writeFile(filepath.filePath, arraybuffer, 'binary', function(err) {
|
||||
//fs.writeFile(filepath.filePath, new Uint8Array(Buffer.from(data.file)), function (err, data) {
|
||||
//fs.writeFile(filepath.filePath, Buffer.from(data.file), function (err, data) {
|
||||
//Has to be binary
|
||||
fs.writeFile(filepath.filePath, arraybuffer, 'binary', function (err, data) {
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
|
|
@ -866,8 +866,8 @@ update_chat = function(obj) {
|
|||
//var file = atob(obj._attachments[filename]["data"])
|
||||
db.getAttachment(obj._id, filename).then(function(data) {
|
||||
console.log(data)
|
||||
//Rewrote this part to use buffers to ensure encoding is coorect -- n1qm
|
||||
var binaryString = Buffer.from(data,"base64").toString('utf-8');
|
||||
//Rewrote this part to use buffers to ensure encoding is corect -- n1qm
|
||||
var binaryString = atob_FD(data);
|
||||
|
||||
console.log(binaryString);
|
||||
var data_with_attachment = doc.timestamp + split_char + doc.msg + split_char + filename + split_char + filetype + split_char + binaryString;
|
||||
|
|
Loading…
Reference in a new issue