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

144
Visualizações
Creating viewable IPFS links rather than instant download

I have a js API (AWS API Gateway + Lambda) that receives form data containing a file (png/jpeg/obj). It takes the file and uploads it to IPFS using Pinata. The problem is that when I hit the Pinata api /pinFileToIPFS the resulting hash isn't viewable in the browser (example), it just instantly downloads. When I hit the same endpoint using postman it is viewable in the browser (example). I want Opensea to pick up on NFT metadata and it doesn't seem to work unless the image is viewable. I'm using lambda-multipart-parser in order to parse the form data from the lambda event body and I'm getting a result like this:

{
  files: [
    {
      content: <Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 87 00 00 01 aa 08 06 00 00 00 e0 2c 88 96 00 00 00 19 74 45 58 74 53 6f 66 74 77 61 72 65 00 ... 6342 more bytes>,
      filename: 'my-img.png',
      contentType: 'image/png',
      encoding: '7bit',
      fieldname: 'file'
    }
  ],
}

I then do the following conversion to prepare the data for the Pinata request:

import FormData from "form-data";
import parser from "lambda-multipart-parser";
import { Readable } from "stream";

const stream = Readable.from(request.files[0]["content"]);
stream.path = request.files[0]["filename"];
let pinataData = new FormData();
pinataData.append("file", stream);

I'm assuming it has to do with the way I'm formatting the image readable data, but I've run out of things to try. Any help would be appreciated!

about 4 years ago · Juan Pablo Isaza
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