Skip to content

Tag: fs

Count all files with specific type in folder

I’m kinda new to coding, and I need to count files with specific type in my folder, but I don’t know how to do it using fs module! My current code: Can someone help me? Answer You can use path.extname like this: Also, as mentioned by MegaMix_Craft, take care about the variable yourExtension. It has to have the dot .value.

Create big json object js

I am using Nodejs to Create a JSON file from a really large JSON object (1GB). In order to avoid memory problems, I’m using createWriteStream : var writeStream = fs.createWriteStream(‘./output/outPut….