cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

Multi HTTP Request function of "JMP 17", can you change the location of each downloaded temporary file?

I tried to do a Multi HTTP Request with the following code, which defaults to

C:\Users\Administrator\AppData\Local\Temp

 


How to modify JSL to change this temporary folder to another path?
Or even save the data directly in memory.
When the Multi HTTP Request is complete, combine the temporary files into one file one by one?

2 REPLIES 2
lala
Level VII

回复: Multi HTTP Request function of "JMP 17", can you change the location of each downloaded temporary file?

http_requests = requests << Get Requests();
data = requests << Download( "show progress", "detailed" );

This data is a list of temporary files that have been downloaded and can be combined into one large file with code.

回复: Multi HTTP Request function of "JMP 17", can you change the location of each downloaded temporary file?

Using the example in the Scripting index:

 

Names Default To Here( 1 );
requests = New Multi HTTP Request();
requests << Add(
	New HTTP Request(
		Method( "GET" ),
		URL(
			"http://cdimage.ubuntu.com/lubuntu/releases/20.04.3/release/lubuntu-20.04.3-desktop-amd64.iso"
		)
	)
);

requests << Add(
	New HTTP Request(
		Method( "GET" ),
		URL( "http://downloads.sourceforge.net/clonezilla/clonezilla-live-2.7.3-19-amd64.iso" )
	)
);

data = requests << Download( "show progress", "detailed", {"$Desktop/lubuntu.iso", "$Desktop/clonezilla.iso"} );
http_requests = requests << Get Requests();
For( i = 1, i <= N Items( http_requests ), i++,
	Show( http_requests[i] << Get Mime Type() )
);			                 

I added:

 

{"$Desktop/lubuntu.iso", "$Desktop/clonezilla.iso"}

This will download the 2 different requests to the 2 locations. The default is $TEMP (of course).

Additionally, when you Add the request to the MutiHTTPRequest, you can give an optional label. If no filenames are specified in Download then it will use the label to create a file in $TEMP.