I want, "fetch" request to wait until the whole website components to load before fetching the HTML of the page.
(我想要“获取”请求,直到整个网站组件加载后,再获取页面的HTML。)
right now it's only loading the minimal data of a website its not waiting until the website to load. (现在,它仅加载网站的最少数据,而没有等到网站加载。)
var express = require('express');
var app = express();
const fetch = require("node-fetch");
const pdf = require("html-pdf");
app.post('/hello', async (req, res) => {
let html = [];
//FETCHING HTML DATA.
await fetch("https://vuetifyjs.com/en/introduction/long-term-support")
.then(resp => resp.text())
.then(body => html.push(body))
//CONVERTING HTML TO PDF
pdf.create(html.toString()).toStream(function(err, stream){
if (err) return res.send(err);
res.type('pdf');
stream.pipe(res);
});
});
app.listen(3000, () => {
console.log(`serving on port number 3000`)
});
ask by CHROMOSOME translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…