Proper way to append lines to a plaintext file

Hi :slight_smile:

As far as I know, the only way with plaintext files is to retrieve all of it, then append client side and make a PUT to overwrite the original file (potentially with some headers that suggest the server to only proceed if it was not modified in the meantime, though honoring these headers this is not a MUST for solid pods iirc).

If you use eg text/turtle to save the data, you can use the N3 patch, which will be processed server side and only requires APPEND permissions. The specification including an example is here, a similar discussion on this forum is here.

In general, you probably could make a turtle file to better describe the semantics of the text (eg use an ontology to mark a comment as a comment, such that computer programs can understand it). So it could be a win-win situation (being able to patch the file and being more expressive about the text itself).

1 Like