File handling

Because workers are designed to work collaboratively across account boundaries (and even server boundaries), a different approach is required for file handling.

Within worker data, and in calls, a file is represented by a block of file info JSON. The JSON can appear anywhere in the worker data, for example as an array. The format of the JSON is described in the File Info Script.

When data is stored by a worker, the file info is made "local". This effectively copies the files into a data node in the worker. Because it is localized on receipt, the sender does not have any requirement to continue to store the files or make them available once the receiver has confirmed they are received.

When data is passed between channels, it can be made "remote". This means that it can be accessed from another account or another server (e.g. through base64 strings or URLs). To avoid unnecessary conversions where two parties are on the same server instance and can use internal storage keys to identify the files, files are usually passed across channels without remote information. If necessary, the receiving worker can call back through the channel and request a remote version if it cannot localize what it has been sent.

Note: as of August 2020, remote file handling has not yet been implemented.