Use currying as suggested by @TongShen - s bind.
bindallows you to use a function with arguments n, when bindyou can get a function n-xwhere you can fix the first n.
In your case, make this a 4 argument function:
var createThumb128 = function(len, fileObj, readStream, writeStream) {
gm(readStream, fileObj.name()).resize(len, len).stream().pipe(writeStream);
};
then create a copy with three arguments, fixing the length '128'and submit this:
var lengthFixed128 = createThumb128 .bind(undefined, '128');
var store = new FS.Store.GridFS("thumbs_128", { transformWrite: lengthFixed128 })
source
share