
However, users can still enjoy the service for free and they can store up to 15GB of data, which is still generous considering you don't have to pay. MEGA has changed quite a bit since its inception when free users were permitted to store 15GB of data. And desktop versions for Mac and Windows exist. Extensions for popular browsers such as Firefox, Chrome, Safari, and Opera. However, nowadays mobile apps are available for Android, iOS, and Windows phones. Its cloud storage is primarily designed to work as a web-based service, which means it is easy to store data online using the browser on any device.

This allows us to pass in a strategy for persisting the download to a file without directly coupling the operator to FileSaver.js.MEGA is a popular secure cloud storage service that is currently used by approximately 150 million people. Once a HTTP response is received, this function is invoked with the download content from inside the accumulator. Notice that this download operator accepts an optional parameter saver. Saver ? : (b : Blob ) => void ) : (source : Observable > ) => Observable They both contain the discriminator field type allowing us to easily return a boolean for the type assertion in our guards. We'll focus on the events HttpResponse and HttpProgressEvents. This way we can access event-specific fields in a type-safe way. The first step for this will be the creation of type guards helping us to distinguish different HTTP events. Since we're dealing with multiple events coming in over time, a RxJS operator is well suited here - so let's create one! This way our components can be decoupled from the underlying network protocol. Now we want to abstract from specific HTTP events to our newly defined data structure. Once a download is done, it will contain a Blob as its content - until then this property is not available, therefore null. Additionally, a download has a number indicating the download progress from 1 to 100. We use TypeScript's union types to define the different download states.

Otherwise it's done or still in progress. Either it hasn't started yet, therefore it's pending. State : 'PENDING' | 'IN_PROGRESS' | 'DONE'Ī Download can be in one of three states.
