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

388
Vistas
How to send my content to a global IPFS node?

To use IPFS in NodeJS, I require ipfs module. To connect a IPFS node I try:

const IPFS=require("ipfs");
const node= await IPFS.create();

After that, When I run NodeJS in PowerShell, The below messages emerge:

Swarm listening on /ip4/192.168.1.100/tcp/4002/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
Swarm listening on /ip4/192.168.88.1/tcp/4002/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
Swarm listening on /ip4/192.168.49.1/tcp/4002/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
Swarm listening on /ip4/127.0.0.1/tcp/4002/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp

I think the above messages are mentioning that I connected to a local IPFS node. If my thought is true, It can be because of IPFS.create(). So, I should put a gateway as an argument to that to connecting a global node. I saw some IPFS public gateways on Public Gateway Checker but I don't know how to put one sample in IPFS.create();

Please giude me:

  1. Am I right about the messages on PowerShell?

  2. How to use a global IPFS gateway in my code?

My whole NodeJS code:

const IPFS=require("ipfs");
    async function register(){
        const node=await IPFS.create();
        node.add("Main Content!").then(function(ipfsHash){console.log(ipfsHash)});
    }

Whole result in PowerShell:

Swarm listening on /ip4/192.168.1.100/tcp/4002/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
Swarm listening on /ip4/192.168.88.1/tcp/4002/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
Swarm listening on /ip4/192.168.49.1/tcp/4002/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
Swarm listening on /ip4/127.0.0.1/tcp/4002/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/p2p/12D3KooWCGvmbySrpdCVKACJPjZeeUiMR6gSQffa7W3gWZLSGBxp
{
  path: 'QmUaTPt2Uus46Cgo4YMKze8PpHrCKvZ1YXD2zpffNt8U9S',
  cid: CID(QmUaTPt2Uus46Cgo4YMKze8PpHrCKvZ1YXD2zpffNt8U9S),
  size: 21,
  mode: 420,
  mtime: undefined
}

Thank you a lot!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When you call create(), the client connects to a local node the URL http://localhost:5001. To connect to another HTTP gateway to a global node, simply pass the gateway's URL instead.

const client = await IPFS.create("https://<your-preferred-gateway>");
const { cid } = await client.add("Your content");

See also: create options

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