How to sync shareJS documents with the file system

I'm trying to create a simple text editor with multi-user support for Operational Transform, and while it was quite easy to get the editor to work and sync clients using shareJS, my problem is that I would like to sync the shareJS doc with the Server side Folder structure (this is will eventually git repo)

I am completely new to sharejs and operational conversions and found the shareJS documentation a bit tricky for a more complex example.

Any suggestions on how I can approach this issue?

What I was trying to do was implement a server side client that could get all the document text on update, but (and this lack of experience I'm sure) the only way I can think of is to use the client api to loop through all documents and writing each file to a file. But that sounds terribly ineffective to me. Can anyone point me to any resources that might help or offer some advice on how I might approach this?

+3


source to share


1 answer


It's a little late, but you can still call the getSnapshop method on the server side and dump it to a file on your filesystem. If it doesn't run locally, you can create a tiny expression router on your local machine that will listen for the post request, and you send a dump file to the body of the message sender on your sharejs server, and then on your computer, you dump the body of the message request to a file. which should work.



Beware for security reasons if you are using auth system on your server.

0


source







All Articles