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

180
Visualizações
Exporting JSON string to file on server

So I'm hosting a localhost website on my raspberry pi with Apache and I'm wondering how would I export a JSON string to a file onto the rpi. I know how to export a file but how would I send the file to the rpi so that I can see it on my file explorer. Right now all it does is make send the JSON to whoever is opening the page, but I need it to be sent to my rpi instead of whoever is opening up the webpage such as my phone or another computer on the network. I can use a web server as long as it's free, there wont be much traffic on the website, so any limitations should be alright. Here's my code for exporting to file:

function download(content, fileName, contentType){
    var a = document.createElement("a");
    var file = new Blob([content], {type: contentType});
    a.href = URL.createObjectURL(file);
    a.download = fileName;
    a.click();
}

and

download(JSON.stringify(data, null, 2), 'json.txt', 'text/plain');

I got this code from stackoverflow but I still haven't been able to find exactly what I'm looking for. PHP is fine but I don't really know how to use it, since I'm kind of a new coder. If I'm missing anything in my questions, comment so that I can fix it, because this is my first question.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Well, since you're hosting it on Apache, you could try writing some PHP scripts to automatically save the file contents, like file_put_contents() for example.

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