1.1.1 • Published 8 years ago

r-spider v1.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

r-spider

fetch resource from other site, now only support image.

Quick Start

install

$ npm install r-spider

download single file

provide a resource's url,r-spidercan download this file and auto supplement the file's suffix

const rSpider = require('r-spider');
rSpider('http://inews.gtimg.com/newsapp_bt/0/1763805398/641', <your download path>, (res) => {
	if (!res.err) {
		console.log(res.fileName)
		console.log(res.path)
	}
});

download multi files

provide url list, r-spider will download all the files and return all response in a Array;

const rSpider = require('r-spider');
const url = ['http://inews.gtimg.com/newsapp_bt/0/1763805398/641', 'http://inews.gtimg.com/newsapp_bt/0/1763805398/641'];
rSpider(url, <your download path>, (res) => {
	res.forEach(item => {
		if (!item.err) {
			console.log(item.fileName);
			console.log(item.path);
		}
	});
});

option

hash fileName

const rSpider = require('r-spider');
const options = {
    url: 'http://inews.gtimg.com/newsapp_bt/0/1763805398/641',
    destPath:  <your download path>,// your download path
    fileNameStamp: true // default false 
};
rSpider(options, (res) => {
	res.forEach(item => {
		if (!item.err) {
			console.log(item.fileName);
			console.log(item.path);
		}
	});
});

changelog

  • 1.1.0: add hash fileName
1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago