Exercise: A Virtual Filesystem
Explore how to implement a virtual filesystem in Node.js by modifying a filesystem adapter to store data in memory. Understand how to write and read files using caching techniques, manage asynchronous operations with promises, and handle errors effectively within a structural design pattern context.
We'll cover the following...
We'll cover the following...
Problem statement
Modify our LevelDB filesystem adapter example to write the file data in memory rather than in LevelDB. You can use an object or a Map instance to store the key-value pairs of filenames and the associated data.
Coding challenge
Write your solution code in the following code widget. We’ve already added the package.json file for your ease.