Fastest way to upload big files [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've implemented fineuploader to upload a file without reloading the page. Problem is it is very slow and potentially fails for vary large files (~300M). Note that I am only using Fineuploader 3.1, but expect it will not make a difference to use a more current version.
My question is whether I shouldn't use some sort of Ajax based file upload approach at all for large files, but based on their size fall back to some more traditional solution which reloads the page? What would be the fastest way to upload a big file using a website and not FTP, etc?

You could have a look at:
Resumable.js Fault Tolerant Resumable File Uploads in JavaScript
As far as I think large files are prone to fault so it is a good idea to make it ressumable.

Fine Uploader has changed a lot since 3.1. The current version is already 4.4. You likely will notice a big difference if you upgrade. Also, Fine Uploader is not causing you failures, your network connection is the culprit.
Fine Uploader 5.0 is set to be released next week, and it includes one big feature that will help you specifically as this feature is aimed as speeding up single file large uploads: concurrent chunking. No other upload library offers this feature (it was very complicated to implement). The concurrent chunking feature has been shown to speed up single file large uploads by a factor of at least 2. It does this by sending as many chunks as possible at the same time for a single file. You can read more about this feature in the pre release notes at http://docs.fineuploader.com/branch/develop/features/concurrent-chunking.html.
Note that Fine Uploader also offers the same features as resumable.js along with many other features such as auto retry, image scaling, form support, direct uploads to S3 and Azure, and more.

Related

Is it faster to upload one big file or more smaller ones? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
first of all I don't know if question like this already exists, I tried but couldn't find it, so if there is I apologize.
I am trying to stream video by sending each frame to client and then displaying it using Javascript on Website. (so it all works using WebSockets).
I host websocket server on a PC (c# is the language). So, I take screenshot of entire screen and immediately send it over to client.
Now, my question is: should I store multiple frames (say 3?) to one file, then upload that file or should I send frame by frame like I already do? I wonder which one is faster?
Thank you.
They are both going to upload the same size of file, one will be split up though so. They should theoretically upload at the same time- this all depends on bandwith also.
I believe that either way they will be split into packets when they cross networks, so it is more about how you would like to deal with the frames on the client side. If I were you I would let the lower technologies handle details like this (e.g the frameworks or libraries you are using) unless you have a specific purpose for sending the frames in intervals because it will add time on to the upload and it adds more room for things to go wrong with separate loads of frames. E.g; you could send the split frames in the wrong order.

What is better performance wise, 1 huge js and css file or multiple files [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Right now, I work on multiple css and js files but I combine them all together in 1 big file. I am not sure if this is the right way. For example my js file is about 200kb(Foundation + jQuery). This file is only loaded at the end of the body, so I am not sure what is the best way, I mean the file size won't get smaller anyway if I split them up.
You should always combine your CSS and JS files into a single file per type as a general rule.
However, if you really want to play around with load optimization, you can try to take advantage of the amount of simultaneous downloads a browser can do at one time. If it can do 6 at a time, then you won't see any major performance hit, and you may even get a performance gain, for having up to 6 separate files so they can download in parallel.
I personally wouldn't count on the simultaneous downloads though. It is a better rule of thumb to just combine them.
You can always use Googles PageSpeed to review your site for load optimization.
You should always combine and minify CSS and JS files. The browser makes fewer a separate request for each file you have. That's a small hit, but if you have a lot of files, it adds up.
https://developers.google.com/speed/docs/insights/MinifyResources
https://blog.hubspot.com/marketing/reduce-http-requests
Task runners like Grunt and Gulp can help with this. You can set up a script to minify and combine (concat) your files all in one action.
Or your IDE might even have it built in, so that everytime you save, a new file is compiled.
Always make sure your JS is right before the closing body tag, unless you have a specific reason to put it higher on the page.
The best solution for optimizing a website is firstly
1. To reduce the number of files to be loaded which reduces the number of browser requests,
2. To use server cache, to removing the repetition of MySql queries or connections
3. To use browser cache for the bigs javascript files
4. Synchronous and asynchronous requests or Ajax/Jquery

How can i show progress & speed of download [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
First, thanks to help me!
How can i make a file first download to the browser and after that just popup the file... e.g http://mega.nz
I did server side script php, it sends to browser the file in chunks with the content-disposition header and it works!
But i want first download it to browser and show progress & speed.
English isn't my main language...
This is not going to be a complete answer, but I will try and get you started on the right path.
First off, you'll need to use the a filesystem API to download your file to the browser cache. For chrome you can find more info here: https://developer.chrome.com/apps/fileSystem
The API extends through HTML5 though, so you can do this in other browsers as well. See this article for more information: http://www.html5rocks.com/en/tutorials/offline/quota-research/#toc-desktop
Now that is how it works behind the scenes, as far as implementing it yourself, take a look at FileSaver.js
From their Github:
FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it. There is a FileSaver.js demo that demonstrates saving various media types.
FileSaver.js is the solution to saving files on the client-side, and is perfect for webapps that need to generate files, or for saving sensitive information that shouldn't be sent to an external server.
This should allow you to target any modern browser for large file downloading, as well as pausing and resuming downloads.
You may also want to look into NodeJS as there will likely be some packages made already you could leverage in your server application.
The way Mega.nz works is by using the FileSystem API. It writes the file in a "cached" form on your system in an example location as such:
AppData\Local\Google\Chrome\User Data\Default\File System\
What are the benefits of this? Visually none, other than it just makes the feel of downloading something different.
How do you do this? It's not an easy, type this code and you're done! They have clouds set up for this. I would first research FileSystem.

What are some advantages and disadvantages for embedding JavaScript in HTML or saving it externally? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm looking for simple bullet point answers please. I've tried looking all over, Googling, other questions here but I can never find both advantages and disadvantages for each method.
This is the answer I got from W3Schools pertaining to external javascript files
Pros
It allows separation of concerns - which is not a big deal in simple pages but as the script grows larger you can have a monolithic html page. Big files in general are not ideal for maintainability
It allows caching - when the browser loads a script externally (whether it's be from your site or a cdn) it caches the file for future use. That's why cdn's are preferred for commonly used scripts. Makes the browser use a cached script instead of building a new one every time the page loads which makes the page load faster
More readable code - this ties into the first bullet point but nevertheless it is important. The smaller the files we humans are working with the better. It is easier to catch mistakes and much easier to pass of the torch to the next developer working on the project or learning from it.
Cons
The browser has to make an http request to get the code
There may be other browser specific reasons as well, but I believe the main reason is the separation of code into different components.
Probably the best advantage of using external javascript files is browser caching - which gives you a good performance boost.
Imagine you have a site that uses MyJsFile.js (a random 50kb javascript file that adds functionality to your websire).
You can:
embed it in every page, and add the 50kb to every page request (not ideal)
link it in every page (<script src="MyJsFile.js"></script>)
The second option is usually prefered because most modern browsers will only get the file once, and serve it from the browser cache instead of downloading it at every request.
Check out similar questions:
Why not embed styles/scripts in HTML instead of linking?
When should I use Inline vs. External Javascript?
Is it better to put the JS code on the html file or in an external file?

Drawbacks of KSS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Has anyone here used KSS?
KSS is an AJAX framework.
KSS has both a client-side Javascript library and server-side support.
The client-side Javascript library needs to be included in your page. It fetches Kinetic style sheets from the server, parses them and binds a set of action to browser events and/or page elements. It is clean Javascript code that can peacefully coexist with other clean Javascript librarys(sic) like JQuery or ExtJS. It is about 100k in production mode. You can integrate your own Javascript code by using its extension mechanism through plugins.
I'm currently working on a project that uses it. Are there any drawbacks and gotchas to be aware of?
What's its cross browser support like?
At first as was really put off by the fact that you don't write the JS by hand, and actually translates a CSS-like file to JS behavior, but seeing in action, I've got to say that it really works quite well. But I haven't done any cross browser tests yet.
Some things that I've found:
it sends HTML from the server, instead of XML and/or JSON and replacing them clientside, meaning higher messages (understandable)
it has problems with scripts that add iframes dynamically on a KSS widget that you reload
some things are hard to debug, while others are made easy thanks to KSS' integration with Firebug

Categories