JSZip和cfs:Meteor应用程序中的集合
所以,我使用的是udondan:jszip,cfs:collection, cfs:标准包和 cfs:我的meteor应用程序中的文件系统包。问题是我无法将我的zip文件存储在FS.COllection中。下面是一些代码: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"})] }); /
//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'})
.然后(功能(内容){
报告.插入(内容);
});
您是在客户端还是服务器上执行插入操作?