Class

UploadGateway (cloud-services/uploadgateway)

@ckeditor/ckeditor5-cloud-services/src/uploadgateway/uploadgateway

class

UploadGateway abstracts file uploads to CKEditor Cloud Services.

Filtering

Properties

  • private readonly

    _apiAddress : string

    CKEditor Cloud Services API address.

  • private readonly

    _token : InitializedToken

    CKEditor Cloud Services access token.

Methods

  • constructor( token, apiAddress )

    Creates UploadGateway instance.

    Parameters

    token : InitializedToken

    Token used for authentication.

    apiAddress : string

    API address.

  • upload( fileOrData ) → FileUploader

    Creates a FileUploader instance that wraps file upload process. The file is being sent at a time when the send method is called.

    const token = await Token.create( 'https://token-endpoint' );
    new UploadGateway( token, 'https://example.org' )
    	.upload( 'FILE' )
    	.onProgress( ( data ) => console.log( data ) )
    	.send()
    	.then( ( response ) => console.log( response ) );
    

    Parameters

    fileOrData : string | Blob

    A blob object or a data string encoded with Base64.

    Returns

    FileUploader

    Returns FileUploader instance.