For anyone using NodeBB to upload a screenshot from node.js
const buffer = await createImage({
path: `screenshot/annotation:${ annotationID }`
, encoding: 'binary'
})
const result = await rp({
url: `${ endpoint }/util/upload?_uid=${ _uid }`,
method: 'POST',
json: true,
headers: {
Authorization
, 'Content-Type': 'multipart/form-data'
},
formData: {
'files[]': {
value: buffer,
options: {
filename: `annotaion-${ annotationID }.jpg`,
contentType: 'image/jpg'
}
}
},
})