Attachments in CloudCode

Attachment fields can be accessed in CloudCode with the following JavaScript API. This applies to fields of type="attachment", type="photo" and type="signature".; // false if not uploaded yet; // null if not uploaded yet'fullscreen').url();
await myobject.mycsvfile.toText();; // output state and urls in APIv4-compatible JSON.

To upload a file, create a new Attachment object using Attachment.create():

const photoData = Buffer.from([...]);

myobject.mycsvfile = await Attachment.create({ filename: 'data.csv', text: csvdata }); = await Attachment.create({ filename: 'photo.jpg', data: photoData });

Last updated