Implementing a upload queue system in ReactJS/NextJS with WebWorkers - reactjs

I'm working on a platform where user can create rooms, join them and share content. One of major features that needs to be implemented is a robust media upload system, and I have a pretty good idea of how i'm going to achieve this on the backend with chunk-based file upload. An average size for content that users will be uploading would be something like 200MB
On the frontend, I'm using NextJS and the idea is to have a webworker to handle all media upload logic and a queue system to not get affected by components re-rendering and not have to wait on dialogbox until the process completes and continue in the background Is this approach going to work and is it a good practice? Is it going to scale and not have to be redesigned in the long run ? If Yes, do you know any example of it? If not why and what is your suggestion?
Link to an Image explaining what I'm trying to achieve

Related

react native uploading multiple large files(+40) best practices

this is a little bit generic question regarding best practices regarding uploading multiple files
so i am making app where user can upload 40+ image at once
since it can be done with fetch or axios but i am afraid of performance issues
like to put to much pressure on js since it is single threaded or causing a crash because of ram usage
what would be the best approach to this like
1-trying to zip the files then upload
2-multi uploading at once
3-uploading one by one
4-other suggestions
Best practice is to upload images in background thread and show upload progress in notification trey. try this library for upload https://github.com/Vydia/react-native-background-upload#readme.

Streaming a Growing Log File To Browser (DRF/Angular)

I am using Django Rest Framework/AngularJs for developing a web application.
I have a use case in which server needs to stream the contents of a file in realtime, the file itself is growing since some other application is logging in to it. I know many inefficient ways to do this.
Can you suggest some better ways to achieve this. The Django "view" function should not return till the file is growing but still be able to send the incremental data to the client.
Any help will be appreciated.

Developing application that represents same screen across multiple browser windows of same machine using AngularJS

I have to create one application that represents the same screen(sharing the state of the view/screen) across multiple browser windows of same machine using AngularJS.
During my analysis I found perhaps AngularJS is not the best technology to handle such scenarios, please find below my thoughts:
If I open the same application in second window of the browser after
opening it in the first one, I need to copy the full
state(rootScope/scope/services) to other window
If user performs some action in one window I need to update the other screen/window accordingly for which I need to use web sockets
Complexity of scope digest cycles execution
Please suggest.
I faced kinda the same scenario while working on chat sessions where the user can open multiple chat windows (as popup windows) while the parent site is open. I used local storage for handling some of its scenarios. I used angular-local-storage for this.
Note: Make sure you are handling (deleting/updating/adding) the data properly while storing it in local storage of browser. Graceful execution is the key or else you'll end up with many bugs.
Hope it helps !

Medium to large file uploads with progress updates in AspNet Core

By medium to large I mean anything from 10mb -> 200mb (sound files if that is important)
basically I want to make an API that does some spectral analysis on the file itself, this would require a file upload. But for UI/UX reasons it would be nice to have a progress bar for the upload process. What are the common architectures for achieving this interaction.
The client application uploading the file will be a javascript client (reactjs/redux) and the API is written in ASP.NET Core. I have seen some examples which use websockets to update the client on progress, and other examples where the client polls for status updates given a resource url to query the status. Are there any best practices (or the "modern way of doing this") for doing such a thing that I should know of? TIA
In general, you just need to save progress status while reading the input stream in your controller to some variable (session-specific variable, because there might be a few file uploading sessions at the same time) and then get this status from the client-side by ajax requests (or signalr).
You could take a look at this example: https://github.com/DmitrySikorsky/AspNetCoreUploadingProgress
I have tried 11 MB files with no problems. There is line
await Task.Delay(10); // It is only to make the process slower
there, don't forget to remove it in the real solution.
In this sample files are loaded by the ajax, so I didn't try really large files, but you can use iframe solution from this sample:
https://github.com/DmitrySikorsky/AspNetCoreFileUploading
The other part will be almost the same.
Hope this helps you. Feel free to ask if have any additional questions.

Protecting the video files from access by third party apps from iOS sandbox

I have a requirement where my app records the video files and stores them in app's documents directory. I want no other app should access these files other that my app. I have set file sharing enabled to NO. But I see some apps like iExplorer can show the video files saved under my app's documents directory. Can I know how this can be avoided.
I have also heard that by mounting the iOS device disk to any unix/linux machine can list out all the contents of the app sandbox.
So I want to know how to prevent this happening.
I tried with adding NSFileProtectionComplete as a attribute when saving the file. But this didn't solve the problem. Please help me on this.
Thanks,
I realize this is a little old but in the hopes of helping the next person who stumbles upon this:
You're probably looking for an encryption solution, combined with the standard steps for hiding your app documents folder as you've mentioned. Encryption won't necessarily hide the files but it will make them unreadable.
NSFileProtectionComplete only encrypts files when the device is locked. See the App Programming Guide for iOS section Protecting Data Using On-Disk Encryption. Also, keep in mind that when testing this, you'll have to wait 10-20 seconds after the device is locked before trying to verify that the file is inaccessible. If you want the encryption to persist past that point you'll have to handle it yourself. Something along what's described in this SO post perhaps.

Resources