# Motoko Binary Concatenation

**URL:** <https://forum.dfinity.org/t/motoko-binary-concatenation/7688>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [October 4, 2021, 5:55pm UTC](https://forum.dfinity.org/t/motoko-binary-concatenation/7688 "2021-10-04T17:55:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aramakme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/aramakme/32/3230_2.png) [@aramakme](https://forum.dfinity.org/u/aramakme)\
**Post date:** [October 4, 2021, 5:55pm UTC](https://forum.dfinity.org/t/motoko-binary-concatenation/7688/1 "2021-10-04T17:55:13Z")

</div>

Is there a reason that # or + doesn’t work for binary concatenation? I had an issue over the weekend where I was trying to push content in via the dfx command line. You are limited to about 1MB on the command line. A 400KB image encoded as “\FF\FF…” over runs that. I tried to use Array.append but I eventually hit the cycle limit when my hash map got over a certain point.

It would be great to have a memory efficient append for binary data. It will also be important if you are trying to build up a large file of a certain format that needs to be encoded.

---

<div class="post-metadata">

**Author:** ![nomeata](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/nomeata/32/733_2.png) [@nomeata](https://forum.dfinity.org/u/nomeata)\
**Post date:** [October 4, 2021, 6:38pm UTC](https://forum.dfinity.org/t/motoko-binary-concatenation/7688/2 "2021-10-04T18:38:35Z")

</div>

The whole story around `Blob` is a bit unsatisfying, but discussion on where it should go (should it be more like arrays maybe) has a bit stalled: [Quo vadis `blob` · Issue #966 · dfinity/motoko · GitHub](https://github.com/dfinity-lab/motoko/issues/966)

That said, maybe you don’t actually want to concatenate binary data (which requires a bunch of boring byte copying), but merely aggregate it without copying (e.g. a list of blobs), so that you can stream it when needed? Depends on the concrete use case, of course.
