My nodejs app has a client authenticated as an enterprise user. It works fine if I try to upload a file as below:
var fs = require("fs");
var stream = fs.createReadStream("z.txt");
boxClient.files
.uploadFile(folderId, filename, stream)
.catch(reason => console.log("Upload file error", reason));
However, I don't have a file but a stream. I tried with a simple readable stream and it fails:
const Readable = require("stream").Readable;
const s = new Readable();
s.push("testing");
s.push(null);
boxClient.files
.uploadFile(folderId, filename, s)
.catch(reason => console.log("Upload file error", reason));The error I get is:
"Error: Unexpected API Response [400 Bad Request] bad_request - Stream ended unexpectedly"
Is the SDK treating file streams differently or am I missing something?