Tag: wget

NodeJS文件下载与WGET?

我正在尝试使用nodejs的WGET方法创build文件下载。 我find了这个: var exec = require('exec'); // Function to download file using wget var download_file_wget = function(file_url) { // extract the file name var file_name = url.parse(file_url).pathname.split('/').pop(); // compose the wget command var wget = 'wget -P ' + DOWNLOAD_DIR + ' ' + file_url; // excute wget using child_process' exec function var child = […]

使用wget将下载的文件名设置在不同的目录中

我需要使用wget下载一个zip文件。 要在当前目录中下载它,我使用命令行运行: $ wget https://github.com/…/[myfile].zip 要在不同的目录中下载它,请添加-P <Path of download directory> : $ wget -P [download directory path] https://github.com/…/[myFile].zip 我想更改为下载文件到[download path directory]但文件名[myFileName] 。 我怎样才能做到这一点? 我已经试过这个: $ wget -P [download directory path] –output-document=[filename.zip] https://github.com/…/[myZipFile].zip 这将文件下载到由我select的文件名的当前目录。 Finnaly我会用这个到一个NodeJS项目使用spawn 。 目前我有这个: var downloader = spawn("wget", ["-P", zipFile, appUrl]);

pipe道stream输出到NodeJS中的Socket.IO

我打开curl在后台下载一些ISO并通知客户有关进度。 自curl,wget和其他许多人清除输出。 我想要在浏览器中看到curl的输出。 我不能pipe它,因为浏览器不明白,它基本上是通过ncurses或我不知道的东西改变输出数据。 我该如何解决这个问题? var spawn = require('child_process').spawn, curl = spawn('curl', ['-oubuntu.iso','http://releases.ubuntu.com/10.04/ubuntu-10.04.4-desktop-i386.iso']); curl.stderr.pipe(process.stdout); // Works perfectly: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 1 694M 1 13.5M 0 0 2193k 0 0:05:24 0:00:06 0:05:18 2439k 但是process.on("data")是不一致的,随机数改变了新行等。

我怎样才能复制一个wget与node.js的function?

是否有可能在node.js应用程序中运行wget ? 我想有一个脚本抓取一个网站,并下载一个特定的文件,但文件的链接的href更改经常。 所以,我认为最简单的方法是find链接的href ,然后只是执行一个wget。 谢谢!