how to decode base64 to image in Nodejs? - javascript

I'm sending an image encoded as base64 through sockets and decoding is not working. The file that must contain the new image is written as base64 instead of a jpg file.
encoding socket:
function encode_base64(filename) {
fs.readFile(path.join(__dirname, filename), function (error, data) {
if (error) {
throw error;
} else {
console.log(data);
var dataBase64 = data.toString('base64');
console.log(dataBase64);
client.write(dataBase64);
}
});
}
rl.on('line', (data) => {
encode_base64('../image.jpg')
})
decoding socket:
function base64_decode(base64str, file) {
var bitmap = new Buffer(base64str, 'base64');
fs.writeFileSync(file, bitmap);
console.log('****** File created from base64 encoded string ******');
}
client.on('data', (data) => {
base64_decode(data,'copy.jpg')
});
// the first few characters in the new file
//k1NRWuGwBGJpmHDTI9VcgOcRgIT0ftMsldCjFJ43whvppjV48NGq3eeOIeeur

Change encode function like below. Also, keep in mind new Buffer() has been deprecated so use Buffer.from() method.
function encode_base64(filename) {
fs.readFile(path.join(__dirname, filename), function (error, data) {
if (error) {
throw error;
} else {
//console.log(data);
var dataBase64 = Buffer.from(data).toString('base64');
console.log(dataBase64);
client.write(dataBase64);
}
});
}
And decode as Below :
function base64_decode(base64Image, file) {
fs.writeFileSync(file,base64Image);
console.log('******** File created from base64 encoded string ********');
}
client.on('data', (data) => {
base64_decode(data,'copy.jpg')
});

You can decode the base64 image using following method .
EDITED
To strip off the header
let base64String = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA'; // Not a real image
// Remove header
let base64Image = base64String.split(';base64,').pop();
To write to a file
import fs from 'fs';
fs.writeFile('image.png', base64Image, {encoding: 'base64'}, function(err) {
console.log('File created');
});
Note :- Don’t forget the {encoding: 'base64'} here and you will be good to go.

You can use a Buffer.from to decode the Base64, and write it to a file using fs.writeFileSync
const { writeFileSync } = require("fs")
const base64 = "iVBORw0KGgoA..."
const image = Buffer.from(base64, "base64")
writeFileSync("image.png", image)
If you have the Base64 string inside a file, you need to decode it into string first, like:
const { writeFileSync, readFileSync } = require("fs")
const base64 = readFileSync(path, "ascii")
const image = Buffer.from(base64, "base64")
writeFileSync("image.png", image)

It seems that the decoding function base64_decode gets the data as a buffer.
Thus, the encoding argument in new Buffer(base64str, 'base64') is ignored.
(Compare the docs of Buffer.from(buffer) vs Buffer.from(string[, encoding])).
I suggest to convert to a string first
function base64_decode(base64str, file) {
var bitmap = new Buffer(base64str.toString(), 'base64');
fs.writeFileSync(file, bitmap);
console.log('******** File created from base64 encoded string ********');
}

Related

Not returning anything base64 decode

I try to decrypt a file with crypto-js (in this file there is a long string of encrypted base64).
but I don't get anything back the file is empty and the log too.
const fs = require("fs");
const CryptoJS = require("crypto-js");
fs.writeFile("2pac.txt", decode(), (err) => {
if (err) throw err;
// success case, the file was saved
console.log("Lyric saved!");
});
function decode() {
// INIT
const encoded = fs.readFileSync("./base64.txt", { encoding: "base64" });
// PROCESS
const decoded = CryptoJS.enc.Utf8.stringify(encoded); // decode encodedWord via Utf8.stringify() '75322541'
console.log(decoded);
return decoded;
}
In the console.log I get the test but I don't get anything(even undefined).
Replace this line:
const decoded = CryptoJS.enc.Utf8.stringify(encoded);
with:
const decoded = CryptoJS.enc.Utf8.stringify(CryptoJS.enc.Base64.parse(encoded));
EDIT:
Reading base64 data from file is another problem. The data imported from the file with the encoding option set to base64 does guarantee a string instead of a buffer but it expects the input to be utf-8 encoding the base64 string again (double encoding).
To fix this, change the following:
const encoded = fs.readFileSync("./base64.txt", { encoding: "base64" });
to:
const encoded = fs.readFileSync("./base64.txt").toString();

how to convert base64 to a zipped file using javascript?

I have this format and i wanted to convert this into a zipped file and unzipped that file using javascript. when i am converting this https://base64.guru/converter/decode/file?fbclid=IwAR3X1qwrnSLTw9cHT9iKl5HxiCRmKG5l0tForN3Odraz_4pYsYApoVprEJE it will give a zipped file and i have to unzip the file to excess the data
{
"awslogs": {
"data": "H4sIAAAAAAAAAFVSUU/bMBD+K5FfR8B2YsfuW0UZYhobouVpQZPjXKm1xKlstwgh/jsXF7RNeXB8d9/33X2+VzJCjOYJNi97IAuyWm6Wv2+v1uvl9RU5I9Ozh4BhQRvJZcNkoxmGh+npOkyHPWaijxeHWIKJqWQX/9ZdrFwAm+4O3eDibjPd7SYPPw5jh4yZYp0CmBE5OgBLueSlrVVd1n1vyg4aW+oOaslVzSvbIyQeumiD2yc3+a9uSBAiWfwiLX7kMTNeHcGnOfhKXI/ElaikYFJKraimnGu8VqKRjeBMKdnUNeNVVeFZM6qU0oIJyXmNYsmhMcmMOCMTSiiuNGdYdPZpGNK/tsRPyW2dNXNPLVlg5CN90+O1JbavVKe1KY3lUIotE2UnQZWwlaIxdS+l1S05a//qZRinnJa0LikvGF9Qtqj0OZVY+YalPQzuCOHlpLefbb00ITgIGXuPaeMtFN/cVNz47WSncSy+u9El6IuyWMGwc1lz9BYRSjT47/PD/Nzentq/MyFFTLKsF5PznyO25ItmjVZca1pJnon2wVm48Q/rFRbQc4pWVxiOY5zXKoM2wfho7ExihpO6ndVrKjLBdHQ9hHuI+8nHE+SjlWJnYoEr4gtjLeznIbqXIo+defpnGIYN2nebG5b8/9iDT25YwRE7XNo/WIEbUM82otvpELPS+uHyEnce7SVvj2/vK7R2rRQDAAA="
}
}
We can use node's zlib and buffer modules in order to parse as base64 and gunzip:
const zlib = require("zlib");
function unzip(str) {
return new Promise((res, rej) => {
// we read in the base64
const data = Buffer.from(str, "base64");
// we create a transform string to gunzip it
const gzip = zlib.createGunzip();
// initialize ret with an empty buffer
let ret = Buffer.alloc(0);
gzip.on("data", function(dat) {
// concatenate the data to ret
ret = Buffer.concat([ret, dat], res.length + dat.length);
});
gzip.on("error", function(err) {
rej(err);
});
gzip.on("end", function() {
// we're done, resolve the promise
res(ret);
});
// send the data to the gunzip stream
gzip.end(data);
});
}
const data = "H4sIAAAAAAAAAFVSUU/bMBD+K5FfR8B2YsfuW0UZYhobouVpQZPjXKm1xKlstwgh/jsXF7RNeXB8d9/33X2+VzJCjOYJNi97IAuyWm6Wv2+v1uvl9RU5I9Ozh4BhQRvJZcNkoxmGh+npOkyHPWaijxeHWIKJqWQX/9ZdrFwAm+4O3eDibjPd7SYPPw5jh4yZYp0CmBE5OgBLueSlrVVd1n1vyg4aW+oOaslVzSvbIyQeumiD2yc3+a9uSBAiWfwiLX7kMTNeHcGnOfhKXI/ElaikYFJKraimnGu8VqKRjeBMKdnUNeNVVeFZM6qU0oIJyXmNYsmhMcmMOCMTSiiuNGdYdPZpGNK/tsRPyW2dNXNPLVlg5CN90+O1JbavVKe1KY3lUIotE2UnQZWwlaIxdS+l1S05a//qZRinnJa0LikvGF9Qtqj0OZVY+YalPQzuCOHlpLefbb00ITgIGXuPaeMtFN/cVNz47WSncSy+u9El6IuyWMGwc1lz9BYRSjT47/PD/Nzentq/MyFFTLKsF5PznyO25ItmjVZca1pJnon2wVm48Q/rFRbQc4pWVxiOY5zXKoM2wfho7ExihpO6ndVrKjLBdHQ9hHuI+8nHE+SjlWJnYoEr4gtjLeznIbqXIo+defpnGIYN2nebG5b8/9iDT25YwRE7XNo/WIEbUM82otvpELPS+uHyEnce7SVvj2/vK7R2rRQDAAA=";
// this uses promises for asynchronous execution
unzip(data).then(v => console.log(v.toString("utf8")));

Unable to produce image from base64 in nodjs

This is byte array response I am getting from google api contact-photo:
console.log('byteArray: ', res1.body);
����JFIF��``"����? !1AQaq2B���"#RT����br��3����������0 !1A2Qaq�"��BRS�����
?���Kѐ�V��,���fu0�AկQ�w���y�
x��i�|��F?���;҆�X����������(+:s��iud���c�Gf�e7�jI�;N�d�%�f����+�Uh4q;Ĭ!9ȨD��[��5�ކ�;h��gCt�͌��و1J��q�a��S��^�V��R�����U��K6�<��"�U��~"u�|Q
ڵ��G���;}�ђ׊��<���sX���>j���hk���~+�^����3�q4��P؝�oZ������4��P{O-j�]�d�c��pG��<7��Q������zd{n��|�`�mɊ��SN�D����}�Hv��0PY�<\�#�T�k!0�R(�Um�n��e�>�a욶˽�8P����{�)���"�
�4��}����6�`���T��!wY�� ��4�y�����+�A]U�M�ֻ⼪�d�N��EcQ`a�u�R��
�
Z"�e/���;-�vL�<c���IH"W2Ga���Ӄ⬨�cݻ#q��c�Y䣃F�G�$�0:�z�" 1��
�S�R�WCh��a���#%#��$�i�y�
u��[�6Ή����(c�Sw˻�G��X3����R��n'�m+>����'
�/;�%�k�4��Z�/l^�z�/l^�z��Z�}k^��!������O����������Dzx�"��>��û#>�#\~{�L-D�k��T�L�����({�TAr9����g}׎��y�{Լ�.�у�8���^��6��"9+��k��K�V�6�����p�¦�Y�~%b�F�lX����_���v����_�O����A�+�G��e]Q*���z��G|�Y{��f��Y�CI�qu*p�v�T�Z�%*R�Kx��c��Is�D�Y�-���O$��!�`��4M���VX�#v�g��U�̦��2E�W��s�7=}z#��Ԯ� c���t^��n|R2H΋�� |�����w�k�9��ٵ�o1�U��nC�r#���7���wZ��-�!n����v�p���P�h_dR�����O5�ޟ�
�*"̙����7-rr�{��<��3��#O�S;:/~�"f~Ϋ;IǸ,�V�[K�\���՗c���d4`6��ѣ��Õ]<ϚN��<��r/Fug<֧���ӢуZ�>z�Cܟ{'c��ˏO��jB��o �����c5�:�6:H�Ώ�c�S<�}{���U_c+�T��D����JY�����=v�&5� �ג3䒮i�Wq�#�$J �ǖ+��4"�FZ��ʗ���ݹ�E�]tV��
!� ��H�Op��)�&���P۷��'�;S�������#�!��/X��GO��iC�8>ȅ:���`$���H��m
I am trying to convert to base64 in nodejs:
base64Image = new Buffer.from(res1.body).toString('base64');
console.log("data:image/png;base64," + base64Image;)
which produces the following base64:
'data:image/png;base64,77+977+977+977+9ABBKRklGAAEBAAABAAEAAO+/ve+/vQDvv70ABQMEDw8NDQ0NEA8ODxANDhAPDw0NDw0QEA8NDg0NDg0NDw8NEA0NDw4NDQ0NFQ0PEhETExMNDRYYFhIYEBITEgEFBQUHBgcPCQkPHBUSFR0VHx0XGB4WHRcXFRUXFR0XGB0dFxUVFRUXFRUXFRUVFRUVFRUXFRUeFRUVFRUVFRUe77+977+9ABEIAGAAYAMBIgACEQEDEQHvv73vv70AHAAAAQQDAQAAAAAAAAAAAAAAAQUGBwgAAgME77+977+9AD8QAAEDAQMIBQkGBwEAAAAAAAEAAgMRBAchBQYSMUFRYXEyQu+/ve+/ve+/vRYiI1JU77+977+977+977+9ExRicu+/ve+/vTPvv73vv73vv73vv73vv73vv70X77+977+9ABwBAAICAwEBAAAAAAAAAAAAAAUGBAcBAggDAO+/ve+/vQAwEQABBAECAwYDCQAAAAAAAAABAAIDBBEFIRIxQQYyUWFx77+9Iu+/ve+/vRQVFkJSU++/ve+/ve+/ve+/ve+/vQAMAwEAAhEDEQA/AO+/ve+/ve+/vUvRkO+/vVbvv73vv70s77+977+977+9ZnUcMO+/vUHVr1Hvv71377+977+977+9ee+/vQt477+977+9ae+/vXzvv73vv70RRj/vv73vv73vv7070obvv71Y77+977+977+977+977+977+977+977+977+977+9KCs6c++/ve+/vWl1ZO+/ve+/ve+/vWMO77+9R2bvv71lNxzvv71qSe+/vTtO77+9ZO+/vSUE77+9Zu+/ve+/vR8A77+977+9K++/vVVoNBxxO8SsIQIWOcioRO+/ve+/vQNb77+9AO+/vTXvv73ehu+/vTto77+977+9ZxxDdO+/vc2M77+977+92YgxSu+/vRHvv71x77+9Ye+/ve+/vVPvv73vv71e77+9Vu+/vQjvv73vv71S77+9f++/ve+/ve+/vQ/vv71V77+977+9Szbvv70877+977+9Iu+/vVXvv73vv70YBn4ide+/vXxRCu+/ve+/vWPvv71G77+9SW9a0KlY77+977+977+9NO+/ve+/ve+/ve+/vVzvv73vv71dS3Dvv70zSyfvv70oI++/vUfvv70c1oBe77+9ZO+/ve+/ve+/vWbvv71GVT0jQ1xAOe+/vVHvv73vv71n77+93aDvv704z6bvv73vv73vv73vv71tf++/ve+/ve+/vWZxJO+/vWpNcTvvv73vv73vv71MV++/ve+/ve+/ve+/vSvvv70NHNq177+977+9R++/ve+/ve+/vTt977+90ZLXihHvv73vv70SPO+/ve+/vRfvv71zWO+/ve+/ve+/vT5q77+977+977+9aGvvv70Y77+977+9fivvv71e77+977+977+977+9M++/vXE077+977+9UB3Yne+/vW9a77+977+9G++/ve+/ve+/ve+/vTTvv73vv71QDntPLWrvv71d77+9ZO+/vWPvv70AA++/vXAGR++/ve+/vTw3Ae+/vRDvv71R77+9He+/ve+/ve+/ve+/ve+/vXpke27vv73vv71877+9YO+/vW3Jigfvv73vv71TTu+/vUTvv73vv73vv73vv71977+9SHYb77+977+9MFBZ77+9PFzvv70j77+9VO+/vWsRITDvv71SKO+/vQBVbe+/vW7vv73vv71l77+9Pu+/vWHsmrbLve+/vThQ77+977+9H++/ve+/vXvvv70p77+977+977+9Iu+/vQvvv73vv73vv707I34sPCvvv73vv71pQe+/ve+/ve+/ve+/vSHvv71u1a1dZu+/vVdl77+9H++/vXHvv73vv70N77+9NO+/vQ7vv71977+977+977+977+9Nu+/vWDvv73vv73vv71U77+977+9IXdZ77+9He+/vSDvv70D77+9NO+/vXkY77+977+977+977+9Au+/vSvvv71BXVXvv71N77+91rsG4ryq77+9ZATvv71O77+977+9RWNRYGHvv71177+9Uu+/vQvvv70LWiLvv71lLwDvv70a77+977+9Oy3vv712TO+/vTxj77+977+9HO+/vUlIIlcyR2Hvv73vv73vv73Tg+KsqO+/vWPduyNx77+977+9Y++/vVnko4NG77+9R++/vSTvv70wOu+/vXrvv70iCQ8x77+977+9DO+/vVPvv71S77+9V0No77+977+9Ye+/ve+/ve+/vUAlI++/ve+/vSTvv71p77+9ee+/vQt177+977+9W++/vTbOie+/ve+/ve+/ve+/vShj77+9BlN3y7sf77+9R++/ve+/vVgz77+977+977+9Ee+/vQBS77+977+9bifvv71tKz7vv73vv73vv73vv70nDO+/vQ4vO++/vSXvv71r77+9NO+/ve+/vVrvv70vbF7vv70feu+/vS9sXu+/vR9677+977+9Wu+/vX1rXu+/ve+/vSHvv73vv73vv73vv73vv73vv71P77+9Fe+/ve+/ve+/ve+/ve+/vRHvv73vv73vv73vv73Hsnjvv70i77+977+9Pu+/ve+/vcO7IxAZDz7vv70jXH5777+9TC1E77+9a++/ve+/vR5U77+9TO+/ve+/vU8977+9Se+/ve+/vVxRHXkk77+9Me+/vSc877+977+9Pe+/ve+/ve+/ve+/ve+/vQB1Uu+/vWLvv70N77+977+977+9KHsS77+9VEFyOe+/ve+/ve+/ve+/vWd9G9eO77+977+9Dgd577+9e9S877+9Lu+/vdGD77+9OO+/ve+/ve+/vQVe77+977+9Nu+/ve+/vSI5GSvvv73vv71r77+977+9S++/vVbvv70277+977+977+977+977+9cO+/vcKm77+9We+/vX4lYu+/vUbvv71sWO+/vRfvv73vv73vv71f77+977+9D++/vXbvv73vv73vv73vv71f77+9T++/ve+/ve+/ve+/vRgaQe+/vSvvv71H77+977+9ZV1RKu+/vRvvv73vv71677+977+9R3zvv71Ze++/vQbvv71m77+977+9We+/vQdDSe+/vXF1KnDvv71277+9VO+/vVrvv70XJREwHO+/vQBKNO+/vWzvv70z77+9yZbvv715Ru+/ve+/ve+/vSLvv70177+9Elzvv70HEkAI3Kfvv73vv73vv70NGSpS77+9S3jvv73vv71j77+977+9SXMG77+9HUTvv70UWe+/vS3vv73vv73vv71PJO+/ve+/vSHvv70FYO+/ve+/vTRN77+9H++/ve+/vVZY77+9QB1277+9Z++/ve+/vVXvv73Mphjvv73vv70XMkXvv71X77+977+9c++/vTc9fXoj77+977+91K7vv70gY++/ve+/ve+/vXRe77+977+9bnxSMkjOi++/ve+/vSB8DwPvv73vv73vv73vv73vv71377+9a++/vTnvv70H77+9A9m177+9bzHvv71V77+977+9bkPvv71yQO+/ve+/vRPvv70eNx3vv73vv73vv713FFrvv73vv70t77+9IRpu77+977+977+977+9du+/vXDvv73vv73vv71Q77+9aF8UZFLvv73vv73vv70O77+9Bu+/vU8SNe+/vd6f77+9DO+/ve+/vTxV77+977+977+977+9De+/vQAqIsyZ77+9GxTvv70F77+977+9Ny1ychLvv71777+9Fe+/vTzvv73vv70VM++/ve+/vSNP77+9ElM7Oi9+77+9GCIAZn7OqztJx7gs77+9VgHvv71bS3YI77+9XO+/ve+/ve+/vdWXY++/ve+/ve+/vWQ0AGA277+977+90aPvv73vv70Zw5VdPM+aTu+/ve+/vTwA77+977+9chgvRnVnPNan77+977+977+906LRg1oP77+9Pnrvv71D3J97JxVjGe+/ve+/vcuPTwTvv73vv71qQu+/ve+/vW8g77+977+977+977+977+9YzXvv70677+9NjpI77+9zo/vv71j77+9Uzzvv719e++/ve+/ve+/vSzvv73vv73vv70abx7vv71fONeq3qt8e1Ftfu+/vWtVIHfvv73vv71aae+/ve+/ve+/vQ8A77+9FzVC77+977+9dsau77+9We+/vTXvv71Ix73vv73vv70AVTYW77+9Xu+/vVZLE2QYKe+/ve+/vUZa77+977+9ypfvv73vv73vv73duRDvv71F77+9XXRW77+977+9DSLvv73vv70gee+/ve+/ve+/vWHvv70UJe+/ve+/ve+/vWjvv73vv73vv73vv73vv709du+/vSYeNRrvv70aIO+/vdeSM+SSrmnvv71Xce+/vSPvv70kSiACIO+/vceWKxfvv70d77+9YAg0IhYNVV9jK++/vVQJRO+/ve+/vRXvv73vv71KWQshTWh277+9Me+/vU4gUe+/ve+/ve+/vRTHmBdI77+977+9Ze+/vREj77+9Ie+/ve+/vQ4dL1jvv73vv71HT++/ve+/vWlD77+9OD7IhToT77+977+977+9YCQb77+977+977+9SO+/ve+/vW0NIe+/vSDvv70b77+9SO+/vU9w77+9Bu+/vSnvv70mUQjvv73vv70A77+9BRdQEdu377+977+9Jxzvv707U++/ve+/ve+/ve+/ve+/ve+/ve+/vQ==',
However, assigning this to <img src="base64 data here"/> doesn't generate image.
Here is the google api example: https://developers.google.com/google-apps/contacts/v3/#retrieving_a_contacts_photo
What am I doing wrong?
JFIF suggests you're actually converting a .jpg file, not a .png.
Make sure the file type (e.g. .png) matches the Mime type (e.g. "image/png").
Also consider specifying charset.
SUGGESTED CHANGE:
base64Image = new Buffer.from(res1.body).toString('base64');
console.log("data:image/jpeg;charset=utf-8;base64," + base64Image;)
<= Assuming it's really a jpeg file
Don't forget to make the corresponding change in your HTML, too...
when you try to do only get a request without specifying the encoding type for an image which is coming from the third party, then the response of the body will be the raw data which you are getting in bytearray variable , so you have add header encoding: "binary" so the response will come in binary format and then you use Buffer and BUffer.from to convert that binary data to base64 and use it in your <img src"data:image/png;base64,yourbase64data"
function getImage(imageUrl) {
var options = {
url: `${imageUrl}`,
encoding: "binary"
};
request.get(options, function (err, resp, body) {
if (err) {
reject(err);
} else {
var prefix = "data:" + resp.headers["content-type"] + ";base64,";
var img = new Buffer(body.toString(), "binary").toString("base64");// var img = new Buffer.from(body.toString(), "binary").toString("base64");
dataUri = prefix + img;
console.log(dataUri);
}
})
}
when use promise
function getImage(imageUrl) {
var options = {
url: `${imageUrl}`,
encoding: "binary"
};
return new Promise(function (resolve, reject) {
request.get(options, function (err, resp, body) {
if (err) {
reject(err);
} else {
var prefix = "data:" + resp.headers["content-type"] + ";base64,";
var img = new Buffer(body.toString(), "binary").toString("base64");// var img = new Buffer.from(body.toString(), "binary").toString("base64");
dataUri = prefix + img;
console.log(dataUri);
resolve(dataUri);
}
})
})}
there is one node module also for this form where i got the solution https://www.npmjs.com/package/imageurl-base64
if you want to read the image form your local disk the fs module help you
var prefix = "data:" + "content-type" + ";base64,";
img: fs.readFileSync(`pathtothelocalimage`, 'base64')
//img: fs.readFile(`pathtothelocalimage`, 'base64')
dataUri = prefix + img;

sending file from js to c# web api as base 64. The input is not a valid Base-64 string

as title description.
I'm trying to take a file from js, send it to my web api, and save it as a file on the server.
in my js, i first take the files, an convert them to a object with the file prop, and a base64 string
for (var i = 0, f; f = files[i]; i++) {
var reader = new FileReader();
reader.onload = (function (theFile) {
return function (e) {
var newFile = { name : theFile.name,
type : theFile.type,
size : theFile.size,
lastModifiedDate : theFile.lastModifiedDate
}
console.log("e")
console.log(e)
console.log(theFile);
var binaryString = e.target.result;
updloadedFile(newFile, binaryString);
};
})(f);
reader.readAsDataURL(f)
Then i try to post it to my api, Sry there is a little angular mixed in here, but it should work like this anyway
function updloadedFile(file,data)
{
var dummyobj = {
Name: file.name,
Extension: file.type,
Path: "",
DataString: data,
}
$http.post('/api/FileBrowser/UploadedFiles/' + $rootScope.User.App_ID,
JSON.stringify(dummyobj),
{
headers: {
'Content-Type': 'application/json'
}
}
).success(function (data) {
}).error(function (data, status, headers, config) {
});
}
At last at my server, i try to take the DataString an convert it to a file
[HttpPost]
public void UploadedFiles(Int64 id, [FromBody]FileModel value)
{
try
{
var path = HttpContext.Current.Server.MapPath("~/gfx/Files/" + id + "/");
File.WriteAllBytes(path+"\\"+value.Name, Convert.FromBase64String(value.DataString));
}
catch (Exception ex)
{
throw;
}
}
But here it throw a exception with the messeage
The input is not a valid Base-64 string as it contains a non-base 64
character, more than two padding characters, or an illegal character
among the padding characters.
My base-64 string look like this in the web api
data:image/gif;base64,R0lGODlhgAIAArP/AAAAAJCQkGBgYDAwMPDw8MDAwOAAAAAA4ODQAADw8PAA8PBQYGDQUGBg8KCAAAAAoCwAAAAAgAIAAkAE/xBIQOq8OOtNLf/gVBFhyY1miqFqy7bpC5fyDNb26eX3zuuk3wcnvBCLkiNSWWQKZaOodEqtWq/YrHbL7Xq/4LB4TC6bz+i0es1uu99wrbEiqNvv+Lw+P9r7/3p9gIN/goSHeIaIi4qLh42Og5CRhXSUj5aXkpmalQSdm5+gnqOkpXuTpwKpp0espa+jsaCznbWat5e5lLuRvY6/jJyqdsGIxpiixHfIhM2hy4k+c8rRq8PLz4DaptbX1dHcfnHk5eKo2MTngemq63ztrfGw0yLzsve0+bb7uP26/3jdM0ewYMFu1t5JA5ctoC+HwCAKC5JBIbMKDDJq3Mixo8eOI/8aiBxJsqTJkyYtFpN4jOU4L0hiypxJ88cXdS6d5Qy1oKfPn0CDCg06woHRo0iTKl2qVGUdVzu3YfxItSrICiizaj3p9Ju3p/3c1BxLtixZNzoZ4lTrrsLQt3CFFmVKt27TqJ42dB1hta/VkFsDa92L9+Ung1HMKl7M2AViKV+9fh0Rt3LcuXYz0yVMcUVhdAT8ivYIWLDpkpzbPsbSuLXr1x1WX5HHlrbl23IraN69lLPez+xCjx6esfTp46knyv4Cu7nzmsvDTIxMGbf1nph5a/etgTNx4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XH2nIV5ZxlmesZRpjKb9UAnKQvYTkLfcIzD7+Mpe8JKYvZVlMRRIyM4Jz5jOhGU1pTpOa1bTmNbGZTW1uk5vd9OY353GqAo2TnPoq5znLaSh0rjM47HRnM9/5TnXGk5zzpCfs7rlOe+aTrWb8POc+/dnOgI4ToAEtqD8Pys+E5nOh97RnQ+kJ0XhKVJ6mGqg4L2rOjGZsoxztKEY/KtCQGsiiG6WoO0/KzpTqs6QZXSk6X/rPlsY0nS29KE3radOB4pSgOjWoTxEKVIUKlaFEdahRI4rUiSq1onL8KE/xOVKSOrWjD2UqSq+q0qyylKom3SpMvyrTrro0rDUd603LmtOz7jStPV3rT98a1LgOda5FretR5RgBADs=
You need to remove data:image/gif;base64, before decoding, you can do this in javascript:
updloadedFile(newFile, binaryString.replace('data:image/gif;base64,', ''));
or in C#
File.WriteAllBytes(path+"\\"+value.Name, Convert.FromBase64String(value.DataString.Replace("data:image/gif;base64,", "")));
As jcubic mention, you need to remove the type tag.
A more dynamic way to remove the tag is to split on ;base64, and take last element. Should work for multiple types, instead of being hardcoded for gif files.
const GetBase64 = (file: any) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
var base64 = `${reader.result}`.split(';base64,').pop();
resolve({name: file.name, size: file.size,type: file.type, content: base64})
};
reader.onerror = error => reject(error);
});
};

Node.js convert binary file to utf8

I have a jrmxl (Jasper report) file stored in a postgresql database in a binary format (bytea). I'm trying to read that file and convert it into a plain jrmxl (XML) file and save it on the disk.
Here is what i've tried so far
var fs = require('fs');
exports.saveFile = function (pg) {
//pg is the postgres connection to query the db
pg.query('Select data from data_file where id = 123', function (err, result) {
if (err) {
console.log(err);
return;
}
var data = result.rows[0].data;
//Buffer.isBuffer(data) === true
// I can get the data here. Now I try to convert it into text
var file = data.toString('utf8');
fs.writeFile('report.jrxml',file, function (er) {
if (er) {
console.log('an error occurred while saving the file');
return;
}
console.log('file saved');
}}
});
}
If i run the code above, the file is saved but it's somehow binary.
How can i convert this to a plain xml file in text format that i can import in ireport for example?
You might try going through a buffer first. I have used this technique to transform DB BLOBs into base64 strings.
var fileBuffer = new Buffer( result.rows[0].data, 'binary' );
var file = fileBuffer.toString('utf8');
I use 'pako' npm package to resolve that issue:
import { connection, Message } from 'websocket';
import * as pako from 'pako';
protected async onCustomMessage(message: Message, con): Promise<void> {
let data;
let text;
if (message.type === 'utf8') {
// console.log("Received UTF8: '" + message.utf8Data + "'");
text = message.utf8Data;
data = JSON.parse(text);
} else {
const binary = message.binaryData;
text = pako.inflate(binary, {
to: 'string',
});
data = JSON.parse(text);
}
}
npm i pako && npm i -D #types/pako

Categories

Resources