Node.js+jade+mongodb+mongoose实现爬虫分离入库与生成静态文件的方法

2020-06-17 06:52:17易采站长站整理

++count;
fs.writeFile('./html/' + count + '.html', str, function (err) {
if (err) {
console.log(err);
}
console.log( `${arcDetail['id']}.html创建成功` + count );
if ( allArc.length ){
setTimeout( function(){
makeHtml( allArc.shift() );
}, 100 );
}
});
}

function getAllArc(){
Article.find( {}, function( err, arcs ){
allArc = arcs;
makeHtml( allArc.shift() );
} ).sort( { 'id' : 1 } );
}
getAllArc();

以上这篇Node.js+jade+mongodb+mongoose实现爬虫分离入库与生成静态文件的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持软件开发网。