Closed adamenagy closed 11 months ago
e.g. to get back Buffer
instead of string
using the request
npm package in nodejs I need to pass in encoding: null
let r = require("request");
r.get({
method: "GET",
uri: `https://developer.api.autodesk.com/modelderivative/v2/designdata/${req.params.versionId64}/thumbnail`,
encoding: null,
headers: {
"Authorization": `Bearer ${tokenSession.getInternalCredentials().access_token}`
}
}, (err, httpResponse, body) => {
res.writeHead(200, {'Content-Type': 'image/png'});
res.end(body);
})
DerivativesApi().getThumbnail()
encodes the result (data.body) to a string instead of keeping it asBuffer
so that it could be passed down to the browser as a source for e.g. in