# Get binary response body from pm.sendRequest and base64 encode

**URL:** <https://community.postman.com/t/get-binary-response-body-from-pm-sendrequest-and-base64-encode/18482>\
**Category:** Help Hub\
**Created:** [December 15, 2020, 12:08pm UTC](https://community.postman.com/t/get-binary-response-body-from-pm-sendrequest-and-base64-encode/18482 "2020-12-15T12:08:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![frans1980](https://avatars.discourse-cdn.com/v4/letter/f/3be4f8/32.png) [@frans1980](https://community.postman.com/u/frans1980)\
**Post date:** [December 15, 2020, 12:08pm UTC](https://community.postman.com/t/get-binary-response-body-from-pm-sendrequest-and-base64-encode/18482/1 "2020-12-15T12:08:01Z")

</div>

Is there a way to get the **binary** response body from `pm.sendRequest`? On [https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#scripting-with-response-data](https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#scripting-with-response-data) I see a `pm.response.text() ` which returns a `String`, (which might be a “binary” String as seems to be common in Javascript).

I’m asking because I’m downloading a PDF file in my Pre-request script and base64 encoding the `response.text()` with `btoa()` but the result is too short so somewhere the data seems to be truncated.

Is there anywhere to report actual bugs for Postman? I’m sure I can reproduce this in a small collection, perhaps someone could fix it then.

Thanks,  
Frans
