!ujrhtmeIGtusHvGHbp:ipfs.io

ip-js

2267 Members
Channel for those working on the JS side of the interplanetary stack (e.g, IPFS, libp2p, IPLD). Bridged to #ip-js in IPFS Discord and Filecoin Slack.2 Servers

Load older messages


SenderMessageTime
13 Feb 2025
@_slack_filecoinproject_U088DNCNY1G:ipfs.iosfroment can mocha hide some unhandled promise rejection ? 00:24:42
@_slack_filecoinproject_U088DNCNY1G:ipfs.iosfroment I do the same test and in vite I have unhandled promise but moche I can just see console.log I added my self to check if the error was thre 00:31:52
@ahile:matrix.org@ahile:matrix.org joined the room.03:36:13
@ahile:matrix.org@ahile:matrix.org left the room.03:36:23
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy Hello! Minor question. Is it possible to use helia node and connect to kubo node from a script right? I mean, I am able to do it from the browser, but I would like to do it from a script now, so want to be sure that it is possible. If not, I guess I should use kubo-rpc-client 05:14:35
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy Just updated previous message with more information. Thanks a lot! 🙂 05:55:40
@_slack_filecoinproject_U06CJ0DLG85:ipfs.ioachingbrain > from a script Do you mean when running under node.js? 06:08:23
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy Thats correct yes. Using a script in typescript or js 06:26:34
@_slack_filecoinproject_U06CJ0DLG85:ipfs.ioachingbrain Yes, you can use Helia in node.js. > ReferenceError: CustomEvent is not defined What version of node are you running? 06:35:50
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy > What version of node are you running? v18.20.5 06:40:37
@_slack_filecoinproject_U06CJ0DLG85:ipfs.ioachingbrain CustomEvent was added in node 19 - you should try to use LTS node at least which is 22 right now 06:42:52
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy Thanks a lot! Let me try and update! 06:43:28
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy Worked! At least establishing the connections with my kubo node using websockets. 07:25:33
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy Thanks again! 🙂 07:25:50
@_slack_filecoinproject_U06CJ0DLG85:ipfs.ioachingbrain No problem. You can use TCP from node.js as well, it’s faster than WebSockets. 07:36:23
@_slack_filecoinproject_U06CJ0DLG85:ipfs.ioachingbrain I believe mocha adds a handler for unhandled rejections to detect internal errors - if the error is not from mocha it is re-emitted on the process object. 07:37:18
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy Ok and last one (I hope) to understand it. I am able to connect to my kubo node both tcp and websockets. But I am trying to fetch the information from cid:
for await (const chunk of heliaNodeFilesystem.cat(CID.parse(cid), {
  onProgress: (evt) => {
    console.info('cat event', evt.type, evt.detail)
  }
})) {
      chunkReceived = false;
      console.log("received chunk", chunk);
      text += decoder.decode(chunk, { stream: true });
    }
I can see that I am not receiving chunks. Why could this be? I guess the node has no route to the CID to retrieve it? Should I need to do any other thing to get the CID? This is the one if curious: QmR8F84sQoP2cRPymXiwLCtVBmHwwhGnd8fCw5W7eR7f5V I am able to get it from my terminal using ipfs cat but not from the script. Thanks a lot again!!:)
08:08:56
@_slack_filecoinproject_U06CJ0DLG85:ipfs.ioachingbrain It works for me?
import { createHelia } from 'helia'
import { unixfs } from '@helia/unixfs'
import { CID } from 'multiformats/cid'

const cid = CID.parse('QmR8F84sQoP2cRPymXiwLCtVBmHwwhGnd8fCw5W7eR7f5V')
const helia = await createHelia()
const fs = unixfs(helia)

for await (const chunk of fs.cat(cid, {
  onProgress: (evt) => {
    console.info('progress', evt)
  }
})) {
  console.info('chunk', chunk)
}
Output:
08:15:30
@_slack_filecoinproject_U068YJG1MRC:ipfs.ioEloy Yes, working properly I got it. I was doing something wrong in the code to get it… not waiting enough, but getting it now. Thanks a lot! 08:25:00
@_discord_531803280863657995:ipfs.ioalex_peeranha joined the room.14:53:44
14 Feb 2025
@_slack_filecoinproject_U061ZESM69L:ipfs.ioHayden I would like to test replication between two OrbitDB peers where there is a dropout in the libp2p connection. What is the easiest way to replicate this? Can I simply call libp2p.hangUp on one of the peers? 11:55:11
@_discord_1248223498636230749:ipfs.iozumerine6840Redacted or Malformed Event11:57:34
@_discord_1248223498636230749:ipfs.iozumerine6840Redacted or Malformed Event11:58:50
@_slack_filecoinproject_U06CJ0DLG85:ipfs.ioachingbrain That will close any open connections, though there’s no guarantee they won’t be reopened - is that enough? 14:07:24
@_slack_filecoinproject_U061ZESM69L:ipfs.ioHayden If I hangUp, there seems to be no disruption to the sync so either that's a good thing or I'm not replicating the dropout properly. I guess the use case is a major dropout, say the connection is disconnected between two peers because the cable is unplugged. 16:55:08
@_slack_filecoinproject_U061ZESM69L:ipfs.ioHayden I'm also assuming hangUp has a "grace" period whereby the stream is allowed to empty before libp2p tries to close it. Maybe I need to pass "hangUp" a signal param to force hangUp to hang up" more abruptly? 17:03:18
@_slack_filecoinproject_U06CJ0DLG85:ipfs.ioachingbrain Yes, it’ll close all connections gracefully which will let all data finish sending. If closing gracefully fails it’ll abort the connections which drops the data on the floor. You can either do this manually (by calling .abort on the connection) or by passing an AbortSignal with a very short timeout. 17:13:35
@_slack_filecoinproject_U061ZESM69L:ipfs.ioHayden > by passing an AbortSignal with a very short timeout. Okay trying this. 17:15:01
@_discord_1125915849602117684:ipfs.iokabostebeztak joined the room.21:41:05
15 Feb 2025
@_slack_filecoinproject_U01MVUHC342:ipfs.iobiglep (OOO until 2025-02-24) changed their display name from biglep to biglep (OOO until 2025-02-24).03:16:09

There are no newer messages yet.


Back to Room ListRoom Version: 10