Use the fs module for creating directories and files of different formats.

PHOTO EMBED

Wed Apr 23 2025 01:29:40 GMT+0000 (Coordinated Universal Time)

Saved by @signup

const fs = require('fs');

// Create a folder
fs.mkdirSync('myFolder');

// Create a text file
fs.writeFileSync('myFolder/info.txt', 'Hello from Node.js');

// Create a JSON file
fs.writeFileSync('myFolder/data.json', '{"name": "Amit"}');

// Create an HTML file
fs.writeFileSync('myFolder/index.html', '<h1>Welcome</h1>');
content_copyCOPY

https://chatgpt.com/share/6806ee0c-b024-800e-83c3-9fa4fe10af07