Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Compress request body to send to PHP webserver

I have a Angular application which makes post request like the following:

  async syncDataWithMaster(): Promise<AxiosResponse<any> | void> {

....

      const jsonData = {
        lastSyncTimeStamp,
        deviceID,
        userUUID,
        lData,
        aData,
        aiData,
        fData,
        oData,
        caData,
      };

      axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded/json/gzip';
      axios.defaults.headers.post.Authorization = token;
      const url = this.endpoint + 'syncData.php';
      return axios.post(url, jsonData, {
        onUploadProgress: progressEvent => {console.log('uploading')},
        onDownloadProgress: progressEvent => {console.log('downloading')}
      }).then((response) => {

        if (response.data.status == 'success') {
          return response;
        } else {
          throw new Error('Could not authenticate user');
        }
      });
    } catch (e) {
    }

    return;
  }

Usually this is fine for most of my user however some users have data up to 15-30mb. I am wondering if it possible to compress the data and send it to my PHP webserver which can then be decoded so that the upload is quicker?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Maybe consider using a compression library (depending on the content of the body). It looks like fflate can do this.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!