Updated on 2022-02-22 GMT+08:00

Uploading Buffer Data

This API is used to upload buffer data to OBS. During the buffer upload, threads are blocked. They are blocked until the upload is completed. The root directory (location of the target OBS bucket) to which the files are uploaded is configured by the user for each device on the Huawei HiLens console (for details, see User Guide > Managing Data). If the user does not configure the root directory for a device, the files fail to be uploaded.

  • API calling

    hilens.upload_bufer(key, buffer, mode)

    For firmware versions later than 1.0.6, use upload_buffer_to_obs(key, buffer, mode).

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Type

    Description

    key

    Yes

    Character string

    Path on OBS to which files are uploaded. Only the OBS file path is needed, for example, test/output.txt, so do not add the website information.

    Note that names of the two directories in key cannot start or end with periods (.) or contain consecutive slashes, such as //.

    buffer

    Yes

    Character string or byte array

    Content to be uploaded. The value type can be str or bytes.

    mode

    Yes

    Character string

    Upload mode. Two options are available, write and append. write indicates the overwriting mode, and append indicates the appending mode.

  • Return value

    If the operation is successful, 0 is returned. Otherwise, the operation fails.