I want to serialize all of the data in my realtime document to a string with which I can later initialize a new realtime document. I want to do this so my users can make copies of their drive files, save different versions, etc, and I can re-initialize the relevant realtime documents from the string.

I see I can call document.getModel().getRoot().toString() to get a string representation of the root CollaborativeMap, but I don't see any easy way to load that string back IN to a CollaborativeMap. Also, the string returned is not JSON, so I can't easily use JSON.parse to turn it back into a normal JS object and iterate from there.

I can make this work by hand. Is there any easy automated way?

有帮助吗?

解决方案

You can do that on the service side using the realtime.get() and update() methods: https://developers.google.com/drive/v2/reference/realtime

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top