# File transfer from gateway to client scope

**URL:** <https://forum.inductiveautomation.com/t/file-transfer-from-gateway-to-client-scope/22128>\
**Category:** Module Development\
**Tags:** sdk\
**Created:** [January 25, 2019, 6:36pm UTC](https://forum.inductiveautomation.com/t/file-transfer-from-gateway-to-client-scope/22128 "2019-01-25T18:36:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [January 25, 2019, 6:36pm UTC](https://forum.inductiveautomation.com/t/file-transfer-from-gateway-to-client-scope/22128/1 "2019-01-25T18:36:42Z")

</div>

In the SDK, I search how to transfert a file read from the gateway to the client scope and write it on the client disk.  
RPC feature need serializable data object. I need to transfert wav sound file.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 25, 2019, 6:41pm UTC](https://forum.inductiveautomation.com/t/file-transfer-from-gateway-to-client-scope/22128/2 "2019-01-25T18:41:43Z")

</div>

Base64 encode it on the client before sending and then Base64 decode on the gateway when you receive it.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 25, 2019, 6:43pm UTC](https://forum.inductiveautomation.com/t/file-transfer-from-gateway-to-client-scope/22128/3 "2019-01-25T18:43:50Z")

</div>

Or just create your own serializable wrapper class:

```java
public class WavBytes implements Serializable {

    private final byte[] wavBytes;

    public WavBytes(byte[] wavBytes) {
        this.wavBytes = wavBytes;
    }

    public byte[] getWavBytes() {
        return wavBytes;
    }
    
}

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 25, 2019, 7:00pm UTC](https://forum.inductiveautomation.com/t/file-transfer-from-gateway-to-client-scope/22128/4 "2019-01-25T19:00:29Z")

</div>

Uhm? Byte arrays are serializable. Just return one from your RPC call. Or send it as the payload of your push notification.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 25, 2019, 7:58pm UTC](https://forum.inductiveautomation.com/t/file-transfer-from-gateway-to-client-scope/22128/5 "2019-01-25T19:58:33Z")

</div>

Ha, I assumed sending a `byte[]` wasn’t working for some reason since he is here asking, but yeah, that would be the first/obvious approach…

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [January 25, 2019, 8:25pm UTC](https://forum.inductiveautomation.com/t/file-transfer-from-gateway-to-client-scope/22128/6 "2019-01-25T20:25:15Z")

</div>

Thanks, I will try the RPC with Byte array. Seems to be the more straightforward.  
It looked to easy to work.
