Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSZip和cfs:Meteor应用程序中的集合_Meteor_Collections_Zip_Fs - Fatal编程技术网

JSZip和cfs:Meteor应用程序中的集合

JSZip和cfs:Meteor应用程序中的集合,meteor,collections,zip,fs,Meteor,Collections,Zip,Fs,所以,我使用的是udondan:jszip,cfs:collection, cfs:标准包和 cfs:我的meteor应用程序中的文件系统包。问题是我无法将我的zip文件存储在FS.COllection中。下面是一些代码: //Defining the collection Reports = new FS.Collection('reports',{ stores: [new FS.Store.FileSystem('reports', {path: "~/public"})] }); /

所以,我使用的是udondan:jszip,cfs:collection, cfs:标准包和 cfs:我的meteor应用程序中的文件系统包。问题是我无法将我的zip文件存储在FS.COllection中。下面是一些代码:

//Defining the collection
Reports = new FS.Collection('reports',{
stores: [new FS.Store.FileSystem('reports', {path: "~/public"})]
});


//Trying to add a file to the collection
var zip = new JSZip();
Reports.insert(zip);
运行代码后,我收到以下错误:

Error: DataMan constructor received data that it doesn't support

有什么方法可以使这些包相互工作吗?

JSZip对象本身不是一个文件。您可以使用函数从中生成一个文件。要创建的文件类型取决于您是否希望在客户端或服务器上运行此文件,以及您希望如何使用此文件。这两个库支持的文件类型是:(根据文档,我自己还没有测试过所有这些文件)

  • Blob
    对象(仅客户端):
    {type:'Blob'}
  • Uint8Array
    {type:'Uint8Array'}
  • ArrayBuffer
    {type:'ArrayBuffer'}
  • 缓冲区
    对象(仅限服务器):
    {type:'nodebuffer'}
例如,这应该是可行的:

zip.generateAsync({type:'arraybuffer'})
.然后(功能(内容){
报告.插入(内容);
});

您是在客户端还是服务器上执行插入操作?