Using meteorhacks' Picker with middleware, and Npm

Has anyone had any experience with using [picker][1] and [npm][2], and Multer as middleware?

After setting up meteorhacks:npm, I tried requiring multer inside the application like this var multer = Meteor.npmRequire('multer')

And using the module like this:

    dest: './fileUploads',
    limits: {
        fileSize: undefined
    //more Multer set up

The application builds, but when I try to navigate anywhere, I get the error:
TypeError: Object #<Multer> has no method 'call' at doCall (packages/meteorhacks:picker/lib/implementation.js:110:1)

Has anyone faced something similar? Or as anyone used Multer with Picker before?

Thank you beforehand.

Hi, I used Multer on pure Node/Express. I guess you should rewrite code for the middleware as:

var multer = Meteor.npmRequire('multer');
Picker.middleware(multer({dest: '/fileUploads'}));
Picker.route('/fileUploads, 'function(params, req, res, next) {

I forgot to include that on the post, but my code already has that section

postPicker.route('/api/upload', function(params, req, res, next){

    if(done === true){
        done = false;


Ah, I found the issue here. multer({}) doesnt return a function - it is a constructor. You should use multer.single() or multer.array() for middleware (see the docs), like

var multer = Meteor.npmRequire('multer');
var multerMid = multer({dest: './fileUploads'});

Alright, I seem to be moving forward. It is not completely working, but at least it is better.

Which docs are you referencing?

In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()).

The problem with this is that I am not planning to make a text only upload. Requests made to that endpoint are intended to bring files with it.