I'm having a hard time using getWorksheetPictureWithFormat, an API for 'aspose cells cloud'

Hello.
I tried to extract the image in the Excel file I uploaded to the storage using “getWorksheetPictureWithFormat”, the API provided by your aspose cells cloud, but there was a problem.

The environment is being implemented with node.js, javascript.

There is information about the request in the official document you provide, but the response is not written in what form it is. So, I confirmed that the “getWorksheetPictureWithFormat” function has buffer data in the body field of the response and used it as follows.

The problem is that the file created through the above process is broken.
So, is there a wrong process in the above process or may I know what type of buffer the response.body form of “getWorksheetPictureWithFormat” is?
Furthermore, is it possible to create an image file in a node.js environment through response.body?
image.png (84.6 KB)

@pnutzzz Hello, after checking, our return is that when there is a format parameter, the data stream of the corresponding format is returned. When there is no format, the DTO description is returned. What language did you use to develop it? I will see if there is a more specific and funny solution.

@xuejianzhang Thank you for your answer. But when I examined the response.body type, it was string. I think it’s binary data from the broken letters. I tried to make a file through the fs.writeFileSync method as below
The created file is broken. Did I use it wrong?

const pictureWithFormatResponse = await cellsApi.getWorksheetPictureWithFormat(pictureWithFormatRequest);
                // console.log("Type of Response => :", typeof pictureWithFormatResponse.body); // string
                // const binaryData = Buffer.from(pictureWithFormatResponse.body, 'base64'); // 'binary', both are not working
                // console.log("Picture found:", binaryData);
                const outputPath = `./image_${i + 1}.png`;
                // fs.writeFileSync(outputPath, pictureWithFormatResponse.body); // not working
                fs.writeFileSync(outputPath, pictureWithFormatResponse.body);
                console.log(`Image ${i + 1} saved to: ${outputPath}`);

@pnutzzz We have reproduced this issue and are working on a fix.

@xuejianzhang Thank you for your hard work. If you’ve fixed it, please let me know by reply. :slight_smile:

@pnutzzz Nodejs seems to convert the returned binary data into a string. We are looking for a better solution. We will reply to you immediately when we have news.