Skip to content

Mixed Synchronous and Asynchronous Patterns in FileOperations#103

Closed
Aditya8369 wants to merge 6 commits intoAkash-nath29:mainfrom
Aditya8369:#100
Closed

Mixed Synchronous and Asynchronous Patterns in FileOperations#103
Aditya8369 wants to merge 6 commits intoAkash-nath29:mainfrom
Aditya8369:#100

Conversation

@Aditya8369
Copy link
Contributor

Changes Made

  • Updated imports: Changed from const fs = require('fs') to const fsPromises = require('fs').promises
  • Updated documentation: Modified the class comment to reflect that operations are now asynchronous
  • Added async helper methods:
  • fileExists(): Uses fsPromises.access for async file existence checks
  • Made ensureDir() async using fsPromises.mkdir
  • Converted all methods to truly asynchronous:
  • createFile, updateFile, patchFile, deleteFile, readFile
  • createDir, deleteDir, listDir, renameDir
  • All now use fsPromises methods instead of synchronous fs.*Sync methods

Testing Results

Thorough testing confirmed:

  • ✅ No regressions: Existing tests (test-scanner.js, test-refactored-scanner.js) still pass
  • ✅ Async functionality: All FileOperations methods work correctly with async/await
  • ✅ Non-blocking behavior: Concurrent operations complete in ~52ms, confirming the event loop isn't blocked
  • ✅ Error handling preserved: All error conditions (non-existent files, duplicates, etc.) are properly handled
  • ✅ Large file support: Successfully handled 1MB files without blocking

solves #100

@vercel
Copy link

vercel bot commented Jan 25, 2026

@Aditya8369 is attempting to deploy a commit to the akash-nath29's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Aditya8369
Copy link
Contributor Author

@Akash-nath29 assign under ecwoc

@Akash-nath29 Akash-nath29 added the ECWoC26 Project For ECWoC 26 label Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECWoC26 Project For ECWoC 26

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments