Open cgatian opened 6 years ago
Finally have it writing the content. I had to cast the response.body to a PassThrough
and then pipe that to a writable stream. Im pretty new to NodeJs development so any pointers would be much appreciated.
session.setCredentials("admin", "admin").loadRepositories()
.then(() => session.query(`
SELECT *
FROM cmis:document WHERE cmis:name LIKE '%test%'`)
)
.then(data => {
return data.results[0].succinctProperties["cmis:objectId"];
})
.then(objectId => {
return session.getContentStream(objectId);
})
.then(res => {
return (res.body as any) as PassThrough;
}).then(text => {
var writeStream = fs.createWriteStream("file1.png", {encoding:"binary"});
text.pipe(writeStream);
});
Hello @cgatian ... I'm also new to Node JS and CMIS so I would like to ask a very basic question. How do you get to run this CmisJS project locally? - I would appreciate any help... Thanks!
I've been able to get the content by calling
But this returns images as encoded text. How can I read the response stream to a file buffer?