我有这段代码,我想在服务器端(即在节点js上)使用此代码,因为这是使用前端js库,如何在带有节点库的节点js中使用它?
let uploadFile = (src,token, signature) => { log('Uploading file to server ...');
const fd = new FormData();
let filename = src.split('\\').pop().split('/').pop();
let file = new Blob([Uint8Array.from(buffers[signature])],
{type : mime.getType(filename)});
fd.append('file',file,filename); fd.append('hash',signature); return fetch( `https://app.blockchainyourip.com/api/files/upload`,
{ method : 'post', body : fd, headers :
{ Authorization : `Bearer ${token}`
} } ) }