Get current open file content

Hi Team,
I am developing extension which needs to capture current open file content and send to sever. Could you provide me a pointer how to get current open file content ? I have gone through the examples but, I could not find any which covers my usecase.

just as an idea: the info about what is currently open in a lab is in the JUPYTERLAB_WORKSPACES_DIR (by default $HOME/.jupyter/lab/workspaces/) and there is a .jupyterlab-workspace file which looks to be a json. i haven’t checked the structure, but i’d try to get the information from there.

and with that information you could open/read the file and do whatever you want with it like send to server.

@spookster Thanks for the idea and it is very helpful