Javascript 在firebase云函数中合并从存储中收集的PDF

Javascript 在firebase云函数中合并从存储中收集的PDF,javascript,node.js,firebase,pdf,google-cloud-functions,Javascript,Node.js,Firebase,Pdf,Google Cloud Functions,我不熟悉node.js和后端编码。我使用vuejs编写了一个应用程序(TMS)。我需要创建新的pdf,并在其中合并其他3个(在前端创建并上载到firebase存储)。这是我的密码: exports.testCloudFunc = functions.storage.object().onFinalize(async object => { const filePath = object.name; const { Logging } = require('@google-clou

我不熟悉node.js和后端编码。我使用vuejs编写了一个应用程序(TMS)。我需要创建新的pdf,并在其中合并其他3个(在前端创建并上载到firebase存储)。这是我的密码:

exports.testCloudFunc = functions.storage.object().onFinalize(async object => {
  const filePath = object.name;

  const { Logging } = require('@google-cloud/logging');
  console.log(`Logged: FILEPATH: ${filePath}`);
  const id = filePath.split('/');
  console.log(`Logged: ID: ${id[0]}/${id[1]}`);
  const bucket = object.bucket;
  console.log(`Logged: BUCKET: ${object.bucket}`);

  async function listFilesByPrefix() {
    const options = {
      prefix: id[0] + '/' + id[1]
    };
    in

    const endFiles = files.filter(el => {
      return (
        el.name === id[0] + '/' + id[1] + '/' + 'invoiceReport.pdf' ||
        el.name === id[0] + '/' + id[1] + '/' + 'POD.pdf' ||
        el.name === id[0] + '/' + id[1] + '/' + 'rateConfirmation.pdf'
      );
    });

    for (let i = 0; i < endFiles.length; i++) {
      console.log(endFiles[i].name);
    }
  }
  listFilesByPrefix().catch(console.error);
});
exports.testCloudFunc=functions.storage.object().onFinalize(异步对象=>{ const filePath=object.name; const{Logging}=require('@googlecloud/Logging'); log(`Logged:FILEPATH:${FILEPATH}`); const id=filePath.split('/'); log(`Logged:ID:${ID[0]}/${ID[1]}`); const bucket=object.bucket; log(`Logged:BUCKET:${object.BUCKET}`); 异步函数listFilesByPrefix(){ 常量选项={ 前缀:id[0]+'/'+id[1] }; 在里面 const endFiles=files.filter(el=>{ 返回( el.name==id[0]+'/'+id[1]+'/'+'invoiceReport.pdf'|| el.name==id[0]+'/'+id[1]+'/'+'POD.pdf'|| el.name==id[0]+'/'+id[1]+'/'+'rateConfirmation.pdf' ); }); for(设i=0;i
你能给我一个建议如何做到这一点(使用什么库和一些可能的示例代码)?我还想知道,当我从存储器中获取文件并将其存储在数组或变量中时,数据是什么类型的。我是否可以避免将其保存到本地临时文件夹以进行进一步的操作,如合并?或者我可以通过提供一个指向endfiles[index]的链接来合并它?我的项目99%完成了。这是唯一要做的事情。非常感谢

有人吗?只需给我提供一个应该在云功能中工作的库名。在一条评论中有一个类似的地方,一位社区成员提到了谢谢!我试试看