Connect private IPFS network with nodejs application

I want to connect my nodejs application with a 4 node private IPFS network.

When i am using npm ipfs module, by default it is connecting to ipfs global repository.
What configurations and code addition i need to make to connect my application with my private IPFS network.
Should i use any other ipfs module??

@hector Need your help Hector

Private network is a libp2p feature that you need to enable for your js-ipfs node.

These two examples should help:

i already have a separate 4 node Private IPFS Network.
I just want to store data from my node application to this ipfs network and i dont want to create a new node.

I thought that maybe i can connect my network using any of the peer address. Is it possible? If Yes, then how?

Then you need to use the IPFS client (you can point it to ipfs API or the cluster’s IPFS Proxy API).

Or the cluster client: (a bit unmaintained).

Using ipfs-http-client i am able to connect to my local peer but when i am adding data into ipfs, instead of returning the proper output with filepath and CID, i am getting this Output: Object [AsyncGenerator] {}

@hector I resolved this issue and i am able to connect it to my local ipfs repoitory.

See, now i have to connect my nodejs application to the IPFS Private Network. I am not able to understand how to do it.
I have 4 ipfs peers, each will have different id.
The API address is same for all the 4 peers i.e. “’/ip4/’”
The Gateway is also same for for all these 4 peers i.e. “’/ip4/”
And when i am trying to connect it, i am getting connection refused error.

I think i am missing something and i am not doing it properly.

Below is my connection logic:
const ipfsClient = require(‘ipfs-http-client’);
const ipfs = ipfsClient(’/ip4/’);

Using this i am able to connect it locally but i am deploying the complete project inside kubernetes cluster, there it is showing connection refused error. means “all local interfaces”.

Yes i agree

My doubt is that i don’t know which address to put here.
Shall i put the peer address here???

@hector I solved my issue…

This IPFS Network is running inside a kubernetes cluster…and my nodejs application is also running in this cluster…
So at the configuration level i pointed my IPFS client to the API service endpoint defined by me in the yaml file.

IPFS we are using just for secure file storage…My client wants to explore MinIO as an alternative to IPFS. So how will IPFS compare with MinIO?