arrays - Binary Data from server is missing bytes when using Javascript XMLHttpRequest -


i have been working on days no avail :( appreciated.

i trying download file typed array using method below:

var oreq = new xmlhttprequest(); oreq.open("get", "/myfile.png", true); //this path file  oreq.responsetype = "arraybuffer";  oreq.onload = function (oevent) {  var arraybuffer = oreq.response;   var array = new uint8array(arraybuffer ); //this array retrieve file };  oreq.send(null); 

when assets being on computer's hard drive works , i'll response looks (this example data):

array[0] = 10; array[1] = 15; array[2] = 20; array[3] = 17; array[4] = 18; array[5] = 23; array[6] = 25; array[7] = 12; array[8] = 2; array[9] = 10; ... 

however when upload server result looks this:

array[0] = 10; array[1] = 15; array[2] = 20; array[3] = 17; array[4] = 18; array[5] = 25;  //this number missing above, should 23 array[6] = 12; array[7] = 2; array[8] = 10; array[9] = 18; ... 

i have tried can think of fix problem. clearing cache, turning gzip on , off, testing different devices (ie loading on phone , computer), nothing has been of far.

what strikes me odd same numbers consistently wrong every time. don't think getting "lost" on network. when test different server different numbers drop. seems every server drops different set of numbers.

does know why , lead me toward direction fix problem? thank much!

i figured out... wow interesting experience.

it turns out ftp client using (filezilla) has setting automatically tries detect files datatype , make necessary adjustments in order display across os systems.

it documented behavior can read here: https://wiki.filezilla-project.org/data_type

when turned behavior off (switched auto binary under "transfer" - "transfer-type" tabs) working again expected.

i want thank jaromanda x willingness help. answers gave me insight needed play around these settings. hope others in future have same problem!


Comments