因此,在我的流星应用程序中,我使用udondan:jszip、cfs:collection、cfs:standard-packages和cfs:filesystem包。问题是我不能将我的压缩文件存储在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有什么办法让这些包互相配合吗?
发布于 2016-09-15 09:34:25
JSZip对象本身不是一个文件。您可以使用generateAsync函数从它生成一个文件。要创建的文件类型取决于您是否希望在客户端或服务器上运行该文件,以及您希望如何使用该文件。这两个库支持的文件类型是:(根据文档,我自己还没有测试过所有这些)。
Blob对象(仅限客户端):{ type: 'blob' }Uint8Array:{ type: 'uint8array' }ArrayBuffer:{ type: 'arraybuffer' }Buffer对象(仅限服务器):{ type: 'nodebuffer' }因此,例如,这应该是可行的:
zip.generateAsync({ type: 'arraybuffer' })
.then(function (content) {
Reports.insert(content);
});https://stackoverflow.com/questions/39506799
复制相似问题