AngularJS COM preSS $ HTTP POST数据 [英] AngularJS compress $http post data

查看:115
本文介绍了AngularJS COM preSS $ HTTP POST数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个应用程序离子,需要大容量数据发送到PHP编写的服务器。我正在寻找一种方式来COM preSS我张贴,以加快我的应用程序中的数据。我不知道什么是最好的方法,我试过 LZString 但COM pressToEn codedURIComponent返回值的大小是太大了,我的需要,我再使用 PAKO 尝试,但还是我没'T满意COM pression率。这是COM $ P $的最好办法PSS将帖子发到服务器的数据?我应该COM preSS它分开(与我提到的图书馆之一),还是有办法让角$ HTTP服务处理COM pression?

I'm creating an Ionic app that needs to send big amounts of data to a server written in php. I'm looking for a way to compress the data I post to speed up my app. I'm not sure of what's the best approach, I tried LZString but the compressToEncodedURIComponent return value size is too big for my needs, I then tried using pako but still I wasn't satisfied with the compression rate. Which is the best way to compress the data I post to the server? Should I compress it separately(with one of the libraries I mentioned) or is there a way to let the Angular $http service handle the compression?

推荐答案

角没有COM pression工具。

Angular has no compression utilities.

如果你真的需要COM preSS,那么你将不得不寻找一个JavaScript库这样做,这是我一窍不通,但是的这个问题这个问题将是很好的地方开始。

If you really need to compress then you will have to find a JavaScript library to do so, which I know nothing about, but this question and this question would be good places to start.

由于COM pression可能需要一些时间本身(而不会总是产生很大的成绩),也许是另一种选择是使数据尽量​​紧凑,使用自己的code,则只是有一个良好的等待UX - 保持用户了解进展情况,让他们做的东西,而它上传的背景。大多数移动用户希望大型数据传输需要一段时间呢。

Given that compression can take some time itself (and doesn't always yield great results), perhaps another alternative is to make the data as lean as possible using your own code, then just have a good 'waiting' UX - keep the user informed about the progress and let them do stuff while it uploads in the background. Most mobile users will expect large data transfers to take a while anyway.

这篇关于AngularJS COM preSS $ HTTP POST数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆