Skip to main content

fsNode API to interact with OS File System - always use fs-extra for async ops!

var fs = require("fs")
var fs = require("fs/promises")

readdir()

fs Static Method to async read dir content

readdirSync()

fs Static Method to Sync read dir content

readFile()

fs Static Method to async read contents of file

readFileSync()

fs Static Method to Sync read file content

writeFile()

fs Static Method to async write data to file

writeFileSync()

fs Static Method to Sync write data to file

appendFile()

fs Static Method to async append data to file

appendFileSync()

fs Static Method to Sync append data to file

mkdirSync()

fs Static Method to Sync make new dir

mkdir()

fs Static Method to async make new dir

existsSync()

fs Static Method to check Sync if path exists

rename()

fs Static Method to async rename file (to new path)

renameSync()

fs Static Method to Sync rename file

fs Static Method to async remove file/Symbolic Link

unlinkSync()

fs Static Method to Sync remove file/Symbolic Link

rmdir()

fs Static Method to async remove dir

rmdirSync()

fs Static Method to Sync remove dir

createReadStream()

fs Static Method to create a Readable file stream

createWriteStream()

fs Static Method to create a Writable file stream

fs-extra

Node Lib extends fs with Promise-based functions that cut down on Boilerplate

References

  1. readdirSync()fs Static Method to Sync read dir content

  2. readFileSync()fs Static Method to Sync read file content

  3. readFile()fs Static Method to async read contents of file

  4. readdir()fs Static Method to async read dir content

  5. writeFile()fs Static Method to async write data to file

  6. writeFileSync()fs Static Method to Sync write data to file

  7. appendFile()fs Static Method to async append data to file

  8. appendFileSync()fs Static Method to Sync append data to file

  9. existsSync()fs Static Method to check Sync if path exists

  10. mkdirSync()fs Static Method to Sync make new dir

  11. mkdir()fs Static Method to async make new dir

  12. unlinkSync()fs Static Method to Sync remove file/Symbolic Link

  13. rename()fs Static Method to async rename file (to new path)

  14. renameSync()fs Static Method to Sync rename file

  15. unlink()fs Static Method to async remove file/Symbolic Link

  16. rmdirSync()fs Static Method to Sync remove dir

  17. rmdir()fs Static Method to async remove dir

  18. createReadStream()fs Static Method to create a Readable file stream

  19. createWriteStream()fs Static Method to create a Writable file stream

  20. Back-end App (JS)App to execute Node.js Runtime with access to fs, DB and network servers

  21. fs-extraNode Lib extends fs with Promise-based functions that cut down on Boilerplate