# Perspective Download base64 file

**URL:** <https://forum.inductiveautomation.com/t/perspective-download-base64-file/43885>\
**Category:** Ignition\
**Created:** [February 26, 2021, 7:16pm UTC](https://forum.inductiveautomation.com/t/perspective-download-base64-file/43885 "2021-02-26T19:16:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![calimero100582](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/calimero100582/32/18630_2.png) [@calimero100582](https://forum.inductiveautomation.com/u/calimero100582)\
**Post date:** [February 26, 2021, 7:16pm UTC](https://forum.inductiveautomation.com/t/perspective-download-base64-file/43885/1 "2021-02-26T19:16:44Z")

</div>

I have a system where I can use an api to get a backup as base64  
I save this backup inside a mssql server  
I then want to be able to download those backup with perspective

If I send the base64 data as plain text, I’m able to convert it using powershell to a working archive

I use binascii.a2b\_base64 to convert to base64 string to bytes  
When I check the size of the result, using “len”, I have the right number 773758, that is the expected file size, but the file I receive using the following is 1160274 bytes.

```auto
system.perspective.download("backup.7z", binascii.a2b_base64(filecontent), "application/zip")

```

Am I missing some encoding or something?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 26, 2021, 7:21pm UTC](https://forum.inductiveautomation.com/t/perspective-download-base64-file/43885/2 "2021-02-26T19:21:05Z")

</div>

I would use a Java function to convert the base64 to bytes; there's a lot of layers of translation involved if you use a Jython method.  
Try this snippet to get a `byte[]`:

> [@How to init myLongArray as array(java.lang.Long, \[myLongValue\])](http://forum.inductiveautomation.com/t/how-to-init-mylongarray-as-array-java-lang-long-mylongvalue/31922/7):
>
> from com.inductiveautomation.ignition.common import Base64 bytes = Base64.decode(string) No muss, no fuss.

---

<div class="post-metadata">

**Author:** ![calimero100582](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/calimero100582/32/18630_2.png) [@calimero100582](https://forum.inductiveautomation.com/u/calimero100582)\
**Post date:** [March 1, 2021, 1:31pm UTC](https://forum.inductiveautomation.com/t/perspective-download-base64-file/43885/3 "2021-03-01T13:31:25Z")

</div>

Any docs on available Java library/tools?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 1, 2021, 3:31pm UTC](https://forum.inductiveautomation.com/t/perspective-download-base64-file/43885/4 "2021-03-01T15:31:16Z")

</div>

Well, for a start you’ve got the whole Java standard library (which does have the ability to decode Base64 as well, it’s just significantly less ergonomic to use): [https://docs.oracle.com/en/java/javase/11/docs/api/index.html](https://docs.oracle.com/en/java/javase/11/docs/api/index.html)

Then you’ve got Ignition specific stuff: [https://github.com/inductiveautomation/ignition-sdk-examples/wiki/Javadocs-&-Notable-Api-Changes](https://github.com/inductiveautomation/ignition-sdk-examples/wiki/Javadocs-&-Notable-Api-Changes)

Then you’ve got all the third party repos we bring in; depending on what scope you’re in this will be different, but you can take a look at the `.ignition` cache, or look in the gateway’s `lib/` directory - you’ll find .jar names, which are usually pretty self explanatory/let you find your way back to a documentation page.

It’s effectively impossible to document it all, especially since it’s subject to change between versions; the `system.` scripting libraries are _technically_ the only officially exposed way; but, for instance, that Base64 module in our `common` directory is so deeply tied to our code (and has been for years) that it’s pretty much perfectly safe to use.
