Append to a file
This action allows you to save a portion of the received binary to a file, appending to the file if it already exists.
It takes three parameters:
- The position in the received binary to be the first byte added to the file.
Position 0 is the start of the message. - From parameter 1's position, how many bytes that you want to append to the file.
You can use the Received binary > Get binary size expression to append the whole received message. - The file path to save to.
You can press the expression button on bottom right of the dialog to use an evaluated path instead.
Only Lacewing Blue is capable of writing to long file paths (more than 255 characters) or using Unicode characters in paths.
At the end of the action, the binary message range indicated by your passed position/number of bytes expressions will be added to the end of the file. If the file didn't exist, it will be created with the range as its content.
Using a filename received from a client/server message is unsafe. To use filenames safely, read Security > Safe filenames section.
Android/iOS/Mac warning
Access to the disk is controlled by the app permissions, and is usually sandboxed so only a few paths can be written to.
To modify app permissions, check the Android/iOS application property tab by selecting the app in Fusion's Workspace toolbar.
Check under the Android object, iOS object or File object to get folder paths you are able to write to.
HTML5/UWP warning
This action will not work in Blue Client HTML5/UWP; it will create an error instead.
You can instead get the received binary as a Blob URL using the Received > Get binary memory address expression. A lot of file path-taking extensions in HTML5/UWP allow HTTP URLs to be passed; if they do, they can read a Blob URL.
Alternatively, advanced Fusion JS devs can call blueClient['GetRecvMsg'](), if you have the CRunBluewing_Client variable. It will return an ArrayBuffer.
If you want these files saved to disk, contact Phi with your pleas (or funds) to have this feature implemented. Note that you can probably only download it, not append to an existing file.