Can support virtual files?

When we download some pictures from the Internet, and the frequency is very fast. If you use disk files, it is inefficient and easy to wear the disk extra. Can support virtual memory files.
Such as:
Sub Action()
dim m as new MemoryBlock(0)
dim f as new FolderItem(m)

  URLConnection1.Send("GET","https://192.168.1.1/snap.jpg",f,1000)
  
End Sub

No, but there’s no reason you can’t just download the data into a string and convert directly to a picture using Picture.FromData.

However, the Send method of the URLConnection class cannot ignore the FolderItem parameter. This means that a file that get or post via URLConnection’s Send method will always create a random temporary file on the disk.
This is not what I want. I hope that during the whole GET or POST process, there will be no records on disk, but only in memory.

var x as new FolderItem(FolderItem.TemporaryFile)
dim y as new Clipboard
y.Text=x.ShellPath
MessageBox x.ShellPath
URLConnection1.Send("GET","https://imagepphcloud.thepaper.cn/pph/image/123/376/574.jpg",x,1000)

This is going to create one “C:\Users\SANTOO~1\AppData\Local\Temp\rbtE00D.tmp”。

Although the urlconnection class does not have the corresponding function, the HttpSocket class does, and the get and post methods do not need folderitem

Sure you can. URLConnection.Send has two signatures. One with and one without a FolderItem.

https://documentation.xojo.com/api/networking/urlconnection.html#urlconnection-send

At this point, I have to make a comment. I think the IDE should pop up multiple overloaded signatures of methods on input, just like VS does. This is user-friendly to people at any level. Rather than relying on memorization or leafing through documents.

1 Like