getDerivativeManifest is not returning the file correctly
HunterZhou97 opened this issue Β· comments
Hello π
If I am not mistaken, the "getDerivativeManifest" function (from DerivativesAPI) is currently deprecated. However, currently if the function is called within a NodeJS project, the function returns a binary string (when previously it returned a Buffer). Causing the "file" to not be manageable correctly within a NodeJS project (Eg. when you download a PDF from a derivative and you want to save the file on the computer with fs, the saved file will appear blank or with an error).
Doing my research, it appears this occurred when changes were made to the "callApi" function (in the src/ApiClient.js file):
- Axios began to be used to make requests (in version 0.9.1)
- Added the prop "responseType" (in version 0.9.6)
- But the prop was not added to the function getDerivativeManifest() in the moment that calls "callApi".
So, to solve this problem, you only need to add the "responseType" prop when the getDerivativeManifest() function calls the callApi() function, and the value of "responseType" must be "arraybuffer" (this so that Axios can interpret that the request response is a Buffer).