Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to obtain a HttpWebRequest range in javascript?

Tags:

javascript

c#

im doing a project where I should take half of the image from one source and another half from another source and then merge them together.

in c# it works like this:

HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("URL");
request1.AddRange(0, 10000);
HttpWebRequest request2 = (HttpWebRequest)WebRequest.Create("URL2");
request2.AddRange(10000, 20000);

and then I read the streams, merge them into a buffer, and write the buffer into a file.

now I have to create a plugin that does the same thing, as far as I know that I can create an extension for firefox with javascript.

do you think that is possible to do the same thing in javascript or I should search another method? I dont even know yet how to create a plugin so I dont know if I can use some programming language(maybe I can even use c# or java to directly create a firefox plugin) can you give me some tips? thanks a lot

like image 877
Simone Avatar asked May 12 '26 03:05

Simone


1 Answers

Yes you can definately do it with ajax

Here you are

Link

 $(function() {
  $.ajax({
    url: 'range-test.txt',
    headers: {Range: "bytes=618-647"},
    success: function( data ) { $('#results').html( data ); }
  });
});
like image 125
Lakis Avatar answered May 14 '26 16:05

Lakis