Another common need in scripting is to download a file from somewhere, and the file can be a binary or text, and it can be just saved to a HDD, or processed first (ideally w/o any temporary files).

There are many ways to do it XSharper.

A dedicated download command, saving to a file.

<download from="" to="x.exe" />

Via a dedicated download command, saving to a variable as text:

<download from="" to="x" />
<print>Length of downloaded string is ${=$x.length} characters</print>

ftp and http are supported, including their ftps:// and https:// variations. There is also a special scheme ftpa:// meaning "active ftp", as opposed to default passive ftp.

While download action is useful, it may be sometimes more to use URLs for remote files in the same way as local filenames are used.

<!-- count how many times word appendTo is mentioned in jquery -->
<set url="" />
<readtext from="${url}" outTo="jq" />
<set cnt="${0}" />
<regex pattern="\bappendTo\b" value="${jq}">
	<set cnt ="${= $cnt +1 }" />
<print>Count (interpreted) =${cnt}</print>

<!-- all of the above in a single C# line -->
	c.WriteLine("Count (C#) = {0}", 
		new Regex("\\bappendTo\\b").Matches(c.ReadText(c.GetStr("url"))).Count); ?>

<!-- all of the above in a single interpreted line -->
<print>Count (XSharper) = ${=new Regex('\bappendTo\b').Matches(c.ReadText(c["url"])).Count }</print>