[SalesForce] Isn’t ContentVersion ‘VersionData’ Updateable (Amendable)

I'm developing an file (attachments/contents) upload app and the process of my upload is that I upload file in chunks to ensure I'm not hitting view state.

For first chunk

insert new attachment

insert new Attachment att = new Attachment(ParentId = parentId,Body = EncodingUtil.Base64Decode(base64BlobValue),Name = fileName, ContentType = contentType);

For remaining chunks

update above uploaded new attachment ie Take the body of the current attachment, convert to base64 string, append base64 value sent from page, then convert back to binary for the body

for(Attachment atm : [select Id, Body from Attachment where Id = :attachmentId]){
                update new Attachment(Id = attachmentId, Body = EncodingUtil.Base64Decode(EncodingUtil.Base64Encode(atm.Body) + base64BlobValue));
}

This is working great for Attachments, but when I apply same mechanism
for CONTENT (ie ContentVersion) its not working as expected.
ContentVersion file body (versiondata) always stores last chunk data only ie its not *APPENDING.*

For First chunk

        insert new ContentVersion(
            versionData = EncodingUtil.Base64Decode(base64BlobValue),
            Title = fileName,
            PathOnClient = '/'+fileName,
            FirstPublishLocationId = libraryId);

For rest chunks

    for(ContentVersion atm : [select Id, VersionData from contentversion where Id = :contentId]){
        update new ContentVersion(
           Id = contentId, 
           VersionData = EncodingUtil.Base64Decode(EncodingUtil.Base64Encode(atm.versionData) + base64BlobValue));
    }

Possible Issue : Body field of Attachment is Creatable and Updatable, whereas VersionData field of ContentVersion is Creatable and Nillable (and NOT Updatable).

Any clue or suggestion, please!

Best Answer

As you mention ContentVersion is not updatable (versions are explicitly immutable, a feature of the content product), you would have to stage the blob somewhere else (perhaps an attachment) until its complete, then create the contentVersion record.