0

i need to change content-type, is it possible to do this without iron-router or collectionFS.

P.S. i am using react-router

example how to do this with iron router: Meteor, generate and download file

Community
  • 1
  • 1

1 Answers1

0

in server side:

import { WebApp } from 'meteor/webapp';
WebApp.connectHandlers.use("/files", function(req, res, next) {
    doc = find('get some data from where you want');
    const headers = {
        'Content-Type': doc.filetype,
        'Content-Disposition': "inline; filename=" + doc.filename
    };
    res.writeHead(200, headers);
    res.end(doc.data);
});