Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda