I'm working on a webapp (python/javascript) to modify a game's save file. The file has certain bytes representing player information, such as the gun, the equipment, etc. The idea is to show an interface representing the information in the file, allow the user to make changes, send the data back to the server, which modifies the file, and allows the user to download it.
My problem is that I don't know which functions should be handled in javascript, and which in Python. I need python for reading the file, but does that mean I should use it to handle the data? If I read the information into relevant variables to send back with JSON, is it redundant because I'm not doing anything with the information in Python other than sending it back?
I've currently been indecisive about two possible ways to go about it. One, and this is the way I currently have it set up, is to handle the file with Python; figure where certain things are, read them into dictionaries, turn it into json, send that to javascript, and then parse the json and update the gui. As I said before, this feels like the wrong way to do it.
The other thing I was considering was to just read the entire file and send that back to javascript to work with. This also seems really incorrect. Javascript (at least as it's implemented in browsers) isn't meant to handle files, and packing/unpacking functions would have to be custom - one of the things I'm seeing as a red flag about this method.
The files are only about 1-2kb, so that wouldn't be a reason not to send it back to the page. In fact, the json I'm sending back is larger than just the contents of the file would be. Still though, I don't much like the idea.
So what do I do? I'm also having trouble organizing the actual code. I know it's bad practice to stick a lot of code into a single function, but dividing into many other functions has made it hard to keep track of things. Is there a good language-agnostic book that will help me with this?