Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download a file in D

How do I download a file in D? I have checked out the standard library, and the sample. I would rather use phobos with the newest dmd2 than tango. All I need to do is download a file (hopefully using std.socket and std.socketstream). Could also use etc.c.curl.

like image 709
alexmherrmann Avatar asked Aug 18 '11 01:08

alexmherrmann


People also ask

Can I download files to D drive?

Path 1: Move Downloads Folder to D Drive via Properties Step 1: Open File Explorer, select This PC in the left menu. Step 2: Right-click Downloads folder and choose Properties. Step 3: In the Downloads Properties window, switch to the Location tab and click Move to get a Select a Destination window.

How do I move files from C drive to D drive?

Right-click on all the files and folders and select the option of copy or cut in the drop-down menu. Step 3 Once the files and folders are cut or copied, now navigate to the D drive and right-click on the drive to open it. Once opened, again right-click to launch the drop-down menu, and here select the option of paste.


1 Answers

etc.c.curl provides the C bindings for curl, so you could use that. That's really the only way that I know of to do it using Phobos at the moment, unless you want to do it with std.socket and handle the HTTP requests and responses yourself (which I assume that you don't really want to do).

However, a D wrapper for the C curl bindings is currently in review in the digitalmars.D newsgroup, which would give you a D API for interacting with curl. Assuming that it passes review (which it probably will, though it may change a fair bit during the review process), it'll end up in Phobos. Once it's merged in, it'll be in the following release. So, it'll probably be in either 2.055 or 2.056, depending on when 2.055 gets released.

Until then, however, you're pretty much going to need to either use the C bindings or download the D curl wrapper currently under review. You can find the documentation here and the code here if you want to try it out. If you do that however, it would be much appreciated if you chimed in on the review in the newsgroup to give feedback on it so that it can be appropriately ironed out and improved prior to inclusion in Phobos.

like image 172
Jonathan M Davis Avatar answered Oct 03 '22 10:10

Jonathan M Davis