【发布时间】:2014-09-21 14:44:31
【问题描述】:
对于这可能是多么微不足道和格式表示歉意。包github链接:https://github.com/CollectionFS
我正在关注从服务器存储文件示例。
在 lib/collections.js 我有:
Images = new FS.Collection("images", {
stores: [new FS.Store.FileSystem("imagest", {path: "~/uploads"})]
});
在服务器/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'
});
在 storeBuffer 调用中引发错误。我尝试了几种从服务器保存文件的变体,但我真的很想使用这个包。
谢谢。
【问题讨论】:
标签: file file-upload meteor npm