Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDerivativeManifest is not returning the file correctly #117

Open
HunterZhou97 opened this issue Mar 23, 2024 · 0 comments
Open

getDerivativeManifest is not returning the file correctly #117

HunterZhou97 opened this issue Mar 23, 2024 · 0 comments

Comments

@HunterZhou97
Copy link

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).

image

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant