I'm using nodejs for getting base64 file but i`m do it in wrong way and i suddenly encoded base64 from utf8 charset. I want to recover my files that stored in db, I tested lot of ways to get back my data but the result is nothing.
My problem for uploading images solved in this question:
Converted base64 image does not work, how can I get true base64 image?
The sample stored image in my db is like this (Its png image with real size: 23275 bytes):
please help me to recover my files with any tools or programming languages.
Edit1:
I used this code to store data in mongo:
In my server file (pure nodejs):
// Get the payload,if any
const decoder = new StringDecoder('utf-8');
let payload = '';
req.on('data', (data) => {
payload += decoder.write(data);
});
req.on('end', () => {
payload += decoder.end();
req.data = {
payload
});
// ... other codes
In my api that stored data in mongo:
const newAttachment = new TicketAttachment({
name:fileName,
type:fileType,
size:req.data.payload.length,
content:req.data.payload
});
newAttachment.save();
And image of data stored in my mongo is: