Skip to content

backToNature/r-spider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

fetch resource from other site

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors