如何使用curl下载文件 [英] How to download a file using curl

查看:130
本文介绍了如何使用curl下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS X上,无法弄清楚如何通过命令行从URL下载文件.它来自静态页面,所以我认为复制下载链接然后使用curl可以解决问题,但并非如此.

I'm on mac OS X and can't figure out how to download a file from a URL via the command line. It's from a static page so I thought copying the download link and then using curl would do the trick but it's not.

我引用了这篇文章也没有用.

I referenced this StackOverflow question but that didn't work. I also referenced this article which also didn't work.

我尝试过的事情:

curl -o https://github.com/jdfwarrior/Workflows.git
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information

.

wget -r -np -l 1 -A zip https://github.com/jdfwarrior/Workflows.git
zsh: command not found: wget

如何通过命令行下载文件?

推荐答案

-o --output选项表示curl将输出写入指定的文件而不是stdout,将URL放在-o之后,因此curl认为该URL是一个要写入的文件,未指定url.您需要在-o之后的文件名,然后是URL.由于网址是基于HTTPS的,因此您可能还需要-k选项:

The -o --output option means curl writes output to file you specicify instead of stdout, you put the url after -o, so the curl thinks the url is a file to write and no url specified. You need a file name after the -o, then the url. Since the url is HTTPS-based, maybe you also need the -k option:

curl -o ./filename -k https://github.com/jdfwarrior/Workflows.git

默认情况下,wget在OS X上不可用.

And wget is not available by default on OS X.

这篇关于如何使用curl下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆