• Upload a file to the uploads-folder on the configured HBO-ICT.Cloud environment

    Parameters

    • fileName: string

      Name of the file to upload, has to contain an extension.

    • dataUrl: string

      Data-URL of the file in base64

    • Optional overwrite: boolean = false

      Set to true to overwrite an existing file, otherwise false. (Default: false)

    Returns Promise<string | ApiFailReason>

    Returns a promise which can either fail (string with reason) or succeed (string with URL to file)

    Throws

    When the API has not been properly configured using configure, an exception is thrown detailing the missing information.

    Example

    The example below will get the Data-URL from a file-input and upload it as "test.png".

    import { api, utils } from "@hboictcloud/api";

    try {
    const data = await utils.getDataUrl(document.querySelector("#fileUpload"));
    const uploadResponse = await api.uploadFile("test.png", data.url);

    console.log(data, uploadResponse);
    }
    catch(reason) {
    console.log(reason);
    }

Generated using TypeDoc