UNPKG

upcdn

Version:

upload file to cdn within office network

24 lines (19 loc) 695 B
#!/usr/bin/env node const request = require("superagent"); async function uploadImage(filePath) { let url = filePath.endsWith(".svg") ? "https://growth-bi-service-fe.in.taou.com/upload/file/" : "http://growth-bi-service-fe.in.taou.com/upload/cdn/"; const resp = await request .post(url) .set("Origin", "http://growth-bi.in.taou.com") .set("Referer", "http://growth-bi.in.taou.com/") .set( "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15" ) .field("quality", "0.6-0.8") .attach("file", filePath); console.log(resp.body); } module.exports = uploadImage;