I want to create a "fake file" from a javascript object, as the libarry I am using is expecting a file as input, but I have an object in memory instead.
So it is expecting code something like this
var file = fs.readFileSync('{/path/to/file}');
lib.addDocument(config, file),
I want to create a fake file from a object I have called payload, and send that instead, my closest attempt so far looks like this:
var fake_file = new stream.Readable({ objectMode: true });
fake_file.push(msg.payload);
fake_file.push(null);
lib.addDocument(config, fake_file),
I feel I am close, but I cant quite get it to work. Current error is
{ Error: Unexpected end of multipart data