In ipfs-http-client
, it can connect to running ipfs daemon.
const ipfsClient = require('ipfs-http-client');
const node = ipfsClient({ host: 'localhost', port: 5001, protocol: 'http'});
but it is not supported timeout.
node.cat(hash, {timeout:50000});
In js-ipfs
is supported timeout but I don’t know how to connect to ipfs daemon.
It seems work as new node even specified host and port in “create”.
const ipfs = require('ipfs');
const node = ipfs.create({ host: 'localhost', port: 5001, protocol: 'http'});
node.cat(hash, {timeout:50000});