app.get('/checkFilelink', async (req, res, next) => { try { const CancelToken = axios.CancelToken; const source = CancelToken.source(); setTimeout(() => { source.cancel('Operation canceled by the user.'); }, 5000); let url = req.query.url; var response = await axios.get(url, { cancelToken: source.token, progress: false }); res.json(response); } catch (e) { res.send(e) } });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter