Posts

Showing posts with the label node

๐Ÿงต JavaScript Interview Prep: Single-Threaded or Multi-Threaded? Event Loop? Async Tasks?

If you’re preparing for a JavaScript interview , chances are you’ll come across questions like: Is JavaScript single-threaded or multi-threaded? How does JavaScript handle asynchronous tasks? What is the event loop, and how does it work? These are fundamental concepts that every JavaScript developer should understand — not only for interviews but also for writing efficient, non-blocking code. Let’s break them down clearly ๐Ÿ‘‡ ๐Ÿง  Question 1: Is JavaScript Single-Threaded or Multi-Threaded? The short answer is: ๐Ÿ‘‰ JavaScript is single-threaded. That means it can execute only one task at a time on a single main thread . This single thread handles: Code execution Function calls Event handling DOM updates (in browsers) So, when you run JavaScript, it processes your code line by line , synchronously . If one piece of code takes too long to finish, the rest of the program must wait — this is called blocking . ⚙️ Question 2: How Does JavaScript Handle Asynchronous Task...

๐Ÿ› ️ How to remove unwanted or unused plugins from Angular or node project?

 Here’s a simple approach to find and remove unused dependencies in your Ionic 3 & Angular 5 app: Steps to Remove Unused Dependencies 1. Identify Unused Dependencies Use the depcheck tool to check which dependencies are unused. Install depcheck globally npm install -g depcheck Run depcheck in your project root depcheck It will list: Unused dependencies (can be removed) Missing dependencies (need to be installed) 2. Remove Unused Dependencies Once identified, uninstall them: npm uninstall package-name Or remove multiple at once: npm uninstall package1 package2 package3 3. Check Cordova Plugins Run: cordova plugin list Manually remove unnecessary plugins: cordova plugin remove plugin-name 4. Clean node_modules and Reinstall rm -rf node_modules package-lock.json npm install 5. Optimize Your Build Run: npm run build --prod to ensure performance improvements.

Pdf to image conversion in angular (Node)

Image
  PDF TO IMAGE IN ANGULAR   Prerequisite: We need to install the below two exe’s for pdf to image conversion http://www.graphicsmagick.org/   -   GraphicsMagick-1.3.34-Q16-win32-dll.exe https://www.ghostscript.com/ - gs909w64.exe   Available node packages for pdf to image conversion in Angular: https://www.npmjs.com/package/pdf2image https://www.npmjs.com/package/pdf2pic https://www.npmjs.com/package/pdf-poppler https://www.npmjs.com/package/pdf-image https://www.npmjs.com/package/file-convert   Issue faced when integrated these libraries: Module not found: Error: Can't resolve ' child_process ' in 'D:\Angular\imagepdfpoc\node_modules\pdf-poppler'   What is child_process: Child_process used to execute the terminal commends through node server. This package executes the (GraphicsMagick, GhostScript) exe’s for convert the pdf to image. Ref: https://www.npmjs.com/package/child_process   Child_p...