Connection and creation of DAGs using Javascript

Is there a clean example in JavaScript on how to connect to a Kubo instance? I need to make a demonstration on how you can add in programmatic way files to a running kubo instance, or to a Helia instance and pin’em to kubo afterwards. I’ve seen something in the demo days videos, but seems a bit closer to magic unless some code is to be found somewhere?!

You may track my efforts here: kolector/orchestrator at ipfsconnection · kosson/kolector · GitHub
This is a little API in Fastify (Node.js and clean JavaScript) targeting to offer an endpoint to where you send via POST some files, and these should be added to the kubo node and also pinned.

Any resources and some guidance would be more than welcome. Thank you!

1 Like

Trying to understand what you’re hoping to accomplish. You want a Helia node to force a Kubo node to pin some files? That won’t be possible using just the IPFS protocol, but you could add your own logic to accomplish it.

For example you could advertise new pins over PubSub, and have a script on the Kubo machine listen to the topic, and pin the new CIDs. Or simply call an HTTP endpoint when you get the new pin, and feed the pins to the Kubo node from there.