Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

240
Visualizações
Download and open pkpass from server in react

I have tried like everything but it isn't working. I am creating a apple wallet pass via https://github.com/walletpass/pass-js When I download it on the node serve where I have implement it, I am getting a valid pass and can load it to the wallet. But when I am download the pass through my react app I am getting a buffer. When decode that buffer I am getting the (looks like) same data content like that from server. But when I am saving that stuff, the size is 113kb and not like the size of the pass I created on the server 65kb and its no valid pkpass file.

Maybe someone has that problem too?

My server code:

   return h
     .response(walletData)
     .type('application/vnd.apple.pkpass')
     .code(200)

My React code:

      .get(`/appleWalletCard/${user.me._id}`)
      .then((response: any) => {
        if (response) {
          const file = new Blob([response.data])
          console.log(file)
          const fileURL = URL.createObjectURL(file)
          const link = document.createElement('a')
          link.href = fileURL
          link.click()
        }
      })
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Here is the solution: You have to set the responseType to array buffer.

.get(`/appleWalletCard/${user.me._id}`, {
        responseType: 'arraybuffer'
      }
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda