How to append write to google cloud storage file from app engine?

后端 未结 2 1443
北恋
北恋 2021-01-11 11:50

This deprecated API supports appending content to google cloud storage file:

FileWriteChannel FileService.openWriteChannel(AppEngineFile file,
                       


        
2条回答
  •  一个人的身影
    2021-01-11 12:04

    While Google Cloud Storage objects are immutable, there is something that could help you if you need to do limited appends: object compose

    This operation basically concatenates the contents of a number of objects in the same bucket under a new name, like cat file1 file2 > newfile but without re-writing data.

    So you could create a new object, upload the contents to append to it, close and subsequently compose this new piece at the end of your main file.

    There is a caveat: a maximum of 1024 'pieces' per object are allowed, and composing objects that are themselves composed counts as composing the original pieces (so you can't cheat the limit by iterated composing).

提交回复
热议问题