Safe data using dataviewjs in metadata

With dataviewjs i build a nice and neaty single line text entry you can type in when it´s displayed in reading view and I want to save the content - assigned to a js variable - in the metadata of the file.

It works to save the data in a json file but this is not that nice because data in json files is not as integrated in dataview as natural metadata. So how could I write the metadata of the file persistently?

The way forward is using app.vault.getFileByPath() and pass that to app.fileManager.processFrontMatter() to set the property. Examples have been given recently in this forum.