Okay, so I’m totally new to
Meteor.wrapAsync, so far I could manage to do everything synchronous
I upload a file to a server, the file is a pdf which needs to be base64 encoded.
So I got this:
convertFile = () -> require('file-base64').encode(file,(err,b64Str) -> if err then throw err opts.data.file = b64Str HTTP.post(process.env.UPLOAD_URL,opts) ) convertFileSync = Meteor.wrapAsync(convertFile) convertFileSync()
The only problem is the HTTP call which throws an “Meteor code must always run within a Fiber” error.
I had the same problem with the encoding function as well, but managed to resolve that by using
Meteor.wrapAsync on it (hopefully I used it right at least for this one).
How do I get to make the HTTP call now without getting the error?
And more interesting: How do I get a callback from that HTTP call?
According to the docs, I can do either
result = HTTP.post(URL,opts)
Tried both, but I guess it fails before the call is even made…