File 对象#<;事件发射器>;没有方法';storeBuffer';

File 对象#<;事件发射器>;没有方法';storeBuffer';,file,file-upload,meteor,npm,File,File Upload,Meteor,Npm,抱歉,这可能是多么琐碎和格式。链接到github包: 下面是存储服务器示例中的一个文件 在lib/collections.js中,我有: Images = new FS.Collection("images", { stores: [new FS.Store.FileSystem("imagest", {path: "~/uploads"})] }); 在server/test.js中: var myText = 'Hello world, I wrote

抱歉,这可能是多么琐碎和格式。链接到github包:

下面是存储服务器示例中的一个文件

在lib/collections.js中,我有:

    Images = new FS.Collection("images", {
        stores: [new FS.Store.FileSystem("imagest", {path: "~/uploads"})]
    });
在server/test.js中:

  var myText = 'Hello world, I wrote this..:)';
  var buffer = Buffer(myText.length);

  for (var i = 0; i < myText.length; i++) {
      buffer[i] = myText.charCodeAt(i);
  }
  Images.storeBuffer('serverFile.txt', buffer, { 
      // Set a contentType (optional)
      contentType: 'text/plain',
      noProgress: false,
      // Attach custom data to the file  
      metadata: { text: 'some stuff' },
      // Set encoding (optional default 'utf-8')
      encoding: 'utf-8'
  });  
var myText='helloworld,我写了这个..:);
var buffer=buffer(myText.length);
对于(var i=0;i
在storeBuffer调用时引发错误。我尝试了几种从服务器保存文件的方法,但我真的很想使用这个软件包

谢谢。

声明方法storeBuffer应该在devel分支中可用,或FS.File.setDataFromBuffer,但这两种方法都不适用于我

但是我通过阅读FS.File的源代码找到了一个解决方案:

file = new FS.File()
    file.attachData buffer, {type: "text/plain"}, ->
        Images.insert file