function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kshitij GundaleKshitij Gundale 

How to get a image from salesforce rich text using node.js if I have the url?

var url = 'https://cunning-wolf-lr1avv-dev-ed--c.documentforce.com/servlet/rtaImage?eid=0012w00000Kou4b&feoid=00N2w00000FPu0u&refid=0EM2w000001JN20'

const request = https.get(url, response => {
  console.log(response.statusCode)
  if(response.statusCode === 200){

      let chunks = [];

      response.on('data', chunk => {
          chunks.push(chunk)
      }).on('end', () => {
          const buffer = Buffer.concat(chunks)
          const imageId = book.addImage({
              buffer: buffer,
              extension: 'jpg',
          });

          sheet.addImage(imageId, {
              tl: { col: 0, row: 0 },
          });
      })
  }

I want to get the image in base64 encoding from url in the code. The problem is I get statuscode 302 everytime I run the code. Is there any other way to get the image using node.js?
jey welljey well
Nice, Thanks for this get the general info at jsnewstimes (https://jsnewstimes.com/)visit