NodeJS Extension to Create/Write/Append Files

Create a file or write to a file using custom encoding and custom flags.
I documented how to use the extension in the GitHub repo.

6 Likes

hi,
thanks for your work!
I have tried the extension - but in my server action it does not work, can you help me what i can check?


You can start here to find a more specific error.

3 Likes

perfect thx didnt know that!
Will see what i get.

1 Like
"Error: Module WriteFile doesn't exist\n    at App._exec 
(/lib/core/app.js:585:27)\n    at App.exec 
(/lib/core/app.js:535:20)\n    at App.define 
(/lib/core/app.js:517:20)\n    at process.processTicksAndRejections 
(node:internal/process/task_queues:95:5)"

i see that failure in the console - do i need to add the module in it?

Ok i got it.
I installed it new and now it works! :slight_smile:

1 Like

I just added read functionality:

One breaking change: It now uses toSystemPath for reading and writing files. So instead of ./my.json add /my.json for the a file in the root directory of your project. I renamed the modules so you can use it alongside with the previous version.

This will come in handy today, thanks :+1:

One question, why does “Read From File” is in a different category than “Write File”? :stuck_out_tongue:

Also, another detail in the metadata:
Screenshot

That “Value” property you can erase, as you’re returning the contents directly

1 Like

Yeah, this is the first extension I wrote back then and I need to overhaul the hjson and a few more things :sweat_smile:

I‘m thinking about merging this extension with my file permission extension and overhaul both.

Currently I‘m working on the new logging extension and integrating the bull extension with that one though.

Oh and I forgot when and where but you asked in some thread how to store stuff in memory and access it during application run time. That’s why I initially built this extension: I run it when the app starts via custom route, read a file, push it to redis and then read from redis whenever needed.

@tbvgl Just a quick question, how do we get a line break into the ‘Content’ section…? I’ve tried all ways and cant seem to crack it:

image