开发者

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开发者_如何学Go 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜