
Node.js Core APIs
fs, path, events, process, os, streams, buffers, child_process, worker threads
1Which method from the fs module allows reading a file asynchronously?
Which method from the fs module allows reading a file asynchronously?
Antwort
fs.readFile() reads the entire file asynchronously and returns its content in a callback. The fs.read() method exists but works with file descriptors for partial reads. fs.readFileSync() is the synchronous version. This asynchronous API avoids blocking the event loop during expensive I/O operations.
2What is the main difference between path.join() and path.resolve()?
What is the main difference between path.join() and path.resolve()?
Antwort
path.join() simply concatenates path segments, while path.resolve() resolves paths into an absolute path from the current directory. For example, path.join('a', 'b') returns 'a/b', while path.resolve('a', 'b') returns a complete absolute path like /current/dir/a/b. Use path.resolve() to get guaranteed absolute paths.
3Which flag to use with fs.writeFile() to append content without overwriting the file?
Which flag to use with fs.writeFile() to append content without overwriting the file?
Antwort
The 'a' flag (append) opens the file in append mode, preserving existing content and adding to the end. The default 'w' flag (write) overwrites the file. Other flags exist like 'r' (read), 'wx' (write exclusive), etc. Flags are inherited from the POSIX system and provide fine control over file opening behavior.
Which method from the path module normalizes a path by resolving . and .. segments?
How to create a directory and all its missing parents with fs?
+22 Interview-Fragen
Weitere Node.js / NestJS-Interviewthemen
Node.js Fundamentals
Asynchronous Programming
Express.js Basics
NestJS Fundamentals
REST API Design
Validation & DTO
API Documentation & Contracts
Error Handling
Unit Testing
Task Scheduling
NestJS Modules & DI
Configuration & Environment Management
JWT Authentication
Authorization & RBAC
Database with TypeORM
Prisma ORM
Middleware & Interceptors
File Upload
WebSockets
GraphQL with NestJS
End-to-End Testing
Caching with Redis
Queues with Bull
DevOps, Logging & CI/CD
Docker & Containerization
Microservices
Security Best Practices
Performance & Cloud Deployment
Meistere Node.js / NestJS für dein nächstes Interview
Zugang zu allen Fragen, Flashcards, technischen Tests, Code-Review-Übungen und Interview-Simulatoren.
Kostenlos starten