Search code examples
node.jstruevault

TrueVault BLOB to file in node


How do I convert/write BLOB objects returned from truevault to files in a nodejs server.

const data = (res.blob).toString('binary')
const buf = new Buffer(data)
fs.writeFileSync("out.js", buf)

When I run this I get [object Blob] in the out.js file.


Solution

  • The TrueVault JS SDK doesn't currently support accessing blobs in that way from Node.js; the methods for reading the contents of blobs are intended for use in web applications. If you need to access the contents of blobs from your Node.js application, I recommend sending a feature request in their website.