Handle inline images and attachments via data urls
This commit is contained in:
@@ -35,12 +35,24 @@ export function getAttachmentMeta(name: string): Promise<AttachmentMeta> {
|
||||
return syscall("space.getAttachmentMeta", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an attachment from the space
|
||||
* @param name path of the attachment to read
|
||||
* @returns the attachment data encoded as a data URL
|
||||
*/
|
||||
export function readAttachment(
|
||||
name: string,
|
||||
): Promise<string> {
|
||||
return syscall("space.readAttachment", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an attachment to the space
|
||||
* @param name path of the attachment to write
|
||||
* @param encoding encoding of the data ("string" or "dataurl)
|
||||
* @param data data itself
|
||||
* @returns
|
||||
*/
|
||||
export function writeAttachment(
|
||||
name: string,
|
||||
encoding: "string" | "dataurl",
|
||||
@@ -49,6 +61,10 @@ export function writeAttachment(
|
||||
return syscall("space.writeAttachment", name, encoding, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an attachment from the space
|
||||
* @param name path of the attachment to delete
|
||||
*/
|
||||
export function deleteAttachment(name: string): Promise<void> {
|
||||
return syscall("space.deleteAttachment", name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user