Meteor从服务器下载二进制文件?
使用Meteor和Iron路由器,是否有Meteor模块可以方便地在Meteor应用程序容器之外的本地文件系统上提供二进制文件供下载 因此,如果Meteor应用程序位于Meteor从服务器下载二进制文件?,meteor,Meteor,使用Meteor和Iron路由器,是否有Meteor模块可以方便地在Meteor应用程序容器之外的本地文件系统上提供二进制文件供下载 因此,如果Meteor应用程序位于/home/Meteor/app中,是否可以提供Meteor中/data/files的下载链接 我猜答案是否定的,因为流星似乎在它的容器中隔离了自己,但我想我会问 我不想把这些文件放在Meteor的/public中,因为它们需要放在Meteor应用程序之外的网络文件夹中。它没有直接回答问题,但我是这样做的。也许有更好的方法 Web
/home/Meteor/app
中,是否可以提供Meteor中/data/files
的下载链接
我猜答案是否定的,因为流星似乎在它的容器中隔离了自己,但我想我会问
我不想把这些文件放在Meteor的
/public
中,因为它们需要放在Meteor应用程序之外的网络文件夹中。它没有直接回答问题,但我是这样做的。也许有更好的方法
WebApp.connectHandlers.use('/filename.txt', function(req, res, next) {
//the filename in the url and the filename on disk don't have to be
//the same but I made them the same here
var fs = Npm.require('fs');
var data = fs.readFileSync("/path/to/filename.txt");
//if it's in the project's private directory,
//or if you are working in a package and you added filename.txt with addAssets
//you can probably just use
//var data = Assets.getBinary("filename.txt");
res.write(data);
res.end();
});
我认为可以使用这个包从外部为文件提供服务:我对CollectionFS的理解是,它使用MongoDB存储关于每个文件的信息,包括每个文件在文件系统中的位置。我希望有一些不使用数据库的东西——只是从我指向的文件中获取信息。但这是可行的。