on 2023 Jun 14 9:17 AM
Hello Collogues,
We are creating custom API on DMS Service where we wanted to download file from DMS.
I am able to read file in raw format but not able to convert and download in local Machine .
Can someone suggest how to convert and download?
Custom API is written in NodeJS.
Here is the format of file we are getting from DMS.
Request clarification before answering.
CAP will interpret any retrieved file as UTF-8 while this is not always matching the codeset of your file. You can use the underlying SAP Cloud SDK to bypass this UTF-8 conversion as it allows you to specify the Response Type to be the raw buffer and you can handle it the way you want (e.g. for images):
const { OpenApiRequestBuilder } = require('@sap-cloud-sdk/openapi');
const fileBuffer = await new OpenApiRequestBuilder('GET', '/browser/repo/root?objectId=abcd')
.addCustomRequestConfiguration({ responseType: 'arraybuffer' })
.execute({ destinationName: 'SDM_Destination' });
'downloading to local machine' would then require a UI, for which you could look at the UI5 component here: https://blogs.sap.com/2021/08/18/my-journey-towards-using-ui5-uploadset-with-cap-backend/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.