Releases: ipfs-inactive/js-ipfs-http-client
v42.0.0
🏗 API Changes
There are significant and breaking API changes in this release. Please see the migration guide.
-
Callbacks are no longer supported on any API methods. Please use a utility such as
callbackifyon API methods that return Promises to emulate previous behaviour. See the migration guide for more info. -
addnow returns an async iterable. -
addnow acceptsmodeandmtimeoptions on inputs to allow setting mode and mtime metadata for added files. See the core interface docs for more info. -
addresults now contain acidproperty (a CID instance) instead of a stringhashproperty. -
🆕
addresults now includemodeandmtimeproperties if they were set. -
addReadableStream,addPullStreamhave been removed. Please see the migration guide for more info. -
addFromStreamhas been removed. Useaddinstead. -
addFromFshas been removed. Please use the exportedglobSourceutility and pass the result toadd. See the glob source documentation for more details and an example. -
addFromURLhas been removed. Please use the exportedurlSourceutility and pass the result toadd. See the URL source documentation for more details and an example. -
bitswap.statresult has changed -wantlistand values are now an array of CID instances andpeersis now astring[]of peer IDs. -
bitswap.wantlistnow returns an array of CID instances. -
block.rmnow returns an async iterable. -
block.rmnow yields objects of{ cid: CID, error: Error }. -
block.statresult now contains acidproperty (whose value is a CID instance) instead of akeyproperty. -
dht.findProvs,dht.provide,dht.putanddht.querynow all return an async iterable. -
dht.findPeer,dht.findProvs,dht.provide,dht.putanddht.querynow yield/return an object{ id: string, addrs: Multiaddr[] }instead of aPeerInfoinstance(s). -
🆕
files.chmodhas been added. See the core interface docs for info. -
🆕
files.flushnow returns the root CID for the path that was flushed (/by default) -
files.lsPullStreamandfiles.lsReadableStreamhave been removed. Please see the migration guide for more info. -
files.lsnow returns an async iterable. -
files.lsresults now contain acidproperty (whose value is a CID instance) instead of ahashproperty. -
🆕
files.lsresults now includemodeandmtimeproperties if they were set. See the core interface docs for more info. -
files.lsno longer takes alongoption (in core) - you will receive all data by default. -
🆕
files.mkdirnow acceptsmodeandmtimeoptions to allow setting mode and mtime metadata. See the core interface docs for more info. -
files.readPullStreamandfiles.readReadableStreamhave been removed. Please see the migration guide for more info. -
files.readnow returns an async iterable. -
files.statresult now contains acidproperty (whose value is a CID instance) instead of ahashproperty. -
🆕
files.statresult now includesmodeandmtimeproperties if they were set. See the core interface docs for more info. -
🆕
files.touchhas been added. See the core interface docs for info. -
🆕
files.writenow acceptsmodeandmtimeoptions to allow setting mode and mtime metadata. See the core interface docs for more info. -
getnow returns an async iterable. Thecontentproperty value for objects yielded from the iterator is now an async iterable that yieldsBufferListobjects. -
idresult has changed, theaddressesproperty is now aMultiaddr[] -
name.resolvenow returns an async iterable. It yields increasingly more accurate resolved values as they are discovered until the best value is selected from the quorum of 16. The "best" resolved value is the last item yielded from the iterator. If you are interested only in this best value you could useit-lastto extract it like so:const last = require('it-last') await last(ipfs.name.resolve('/ipns/QmHash'))
-
🆕
object.getnow accepts atimeoutoption. It will cause the method to throw with aTimeoutErrorif no data is received within the timeout window. It can be passed as anumberor astring. If anumberis passed it is interpreted as milliseconds, if a string is passed it is interpreted as a human readable duration. -
lsnow returns an async iterable. -
lsresults now contain acidproperty (whose value is a CID instance) instead of ahashproperty. -
lsresults now includemodeandmtimeproperties if they were set. See the core interface docs for more info. -
pin.addresults now contain acidproperty (a CID instance) instead of a stringhashproperty. -
🆕
pin.addnow accepts atimeoutoption. It will cause the method to throw with aTimeoutErrorif no data is received within the timeout window. It can be passed as anumberor astring. If anumberis passed it is interpreted as milliseconds, if a string is passed it is interpreted as a human readable duration. -
pin.lsnow returns an async iterable. -
pin.lsresults now contain acidproperty (a CID instance) instead of a stringhashproperty. -
pin.rmresults now contain acidproperty (a CID instance) instead of a stringhashproperty. -
pingnow returns an async iterable. -
refsandrefs.localnow return an async iterable. -
🆕
refsnow accepts atimeoutoption. It will cause the method to throw with aTimeoutErrorif no data is received within the timeout window. It can be passed as anumberor astring. If anumberis passed it is interpreted as milliseconds, if a string is passed it is interpreted as a human readable duration. -
repo.gcnow returns an async iterable. -
stats.bwnow returns an async iterable. -
swarm.peersnow returns an array of objects with apeerproperty that is astring, instead of aPeerIdinstance. -
swarm.addrsnow returns an array of objects{ id: string, addrs: Multiaddr[] }instead ofPeerInfoinstances.
Other changes
- The protocol name for peer IDs in multiaddrs has changed from 'ipfs' to 'p2p'. There's no changes to data on the wire but this change is seen when multiaddrs are converted to strings.
v42.0.0-pre.0
BREAKING CHANGE: Callbacks are no longer supported on any API methods. Please use a utility such as callbackify on API methods that return Promises to emulate previous behaviour.
BREAKING CHANGE: PeerId and PeerInfo classes are no longer statically exported from ipfs-http-client since they are no longer used internally.
BREAKING CHANGE: pin.add results now contain a cid property (a CID instance) instead of a string hash property.
BREAKING CHANGE: pin.ls now returns an async iterable.
BREAKING CHANGE: pin.ls results now contain a cid property (a CID instance) instead of a string hash property.
BREAKING CHANGE: pin.rm results now contain a cid property (a CID instance) instead of a string hash property.
BREAKING CHANGE: add now returns an async iterable.
BREAKING CHANGE: add results now contain a cid property (a CID instance) instead of a string hash property.
BREAKING CHANGE: addReadableStream, addPullStream have been removed.
BREAKING CHANGE: ls now returns an async iterable.
BREAKING CHANGE: ls results now contain a cid property (whose value is a CID instance) instead of a hash property.
BREAKING CHANGE: files.ls now returns an async iterable.
BREAKING CHANGE: files.readPullStream and files.readReadableStream have been removed.
BREAKING CHANGE: files.read now returns an async iterable.
BREAKING CHANGE: files.lsPullStream and files.lsReadableStream have been removed.
BREAKING CHANGE: files.ls now returns an async iterable.
BREAKING CHANGE: files.ls results now contain a cid property (whose value is a CID instance) instead of a hash property.
BREAKING CHANGE: files.ls no longer takes a long option (in core) - you will receive all data by default.
BREAKING CHANGE: files.stat result now contains a cid property (whose value is a CID instance) instead of a hash property.
BREAKING CHANGE: get now returns an async iterable. The content property value for objects yielded from the iterator is now an async iterable that yields BufferList objects.
BREAKING CHANGE: stats.bw now returns an async iterable.
BREAKING CHANGE: addFromStream has been removed. Use add instead.
BREAKING CHANGE: isIPFS is no longer exported from the client, please npm i is-ipfs or include the CDN script tag <script src="https://unpkg.com/is-ipfs/dist/index.min.js"></script> to use this utility in your applications.
BREAKING CHANGE: addFromFs has been removed. Please use the exported globSource utility and pass the result to add. See the glob source documentation for more details and an example.
BREAKING CHANGE: addFromURL has been removed. Please use the exported urlSource utility and pass the result to add. See the URL source documentation for more details and an example.
BREAKING CHANGE: name.resolve now returns an async iterable. It yields increasingly more accurate resolved values as they are discovered until the best value is selected from the quorum of 16. The "best" resolved value is the last item yielded from the iterator. If you are interested only in this best value you could use it-last to extract it like so:
const last = require('it-last')
await last(ipfs.name.resolve('/ipns/QmHash'))BREAKING CHANGE: block.rm now returns an async iterable.
BREAKING CHANGE: block.rm now yields objects of { cid: CID, error: Error }.
BREAKING CHANGE: dht.findProvs, dht.provide, dht.put and dht.query now all return an async iterable.
BREAKING CHANGE: dht.findPeer, dht.findProvs, dht.provide, dht.put and dht.query now yield/return an object { id: CID, addrs: Multiaddr[] } instead of a PeerInfo instance(s).
BREAKING CHANGE: refs and refs.local now return an async iterable.
BREAKING CHANGE: object.data now returns an async iterable that yields Buffer objects.
BREAKING CHANGE: ping now returns an async iterable.
BREAKING CHANGE: repo.gc now returns an async iterable.
BREAKING CHANGE: swarm.peers now returns an array of objects with a peer property that is a CID, instead of a PeerId instance.
BREAKING CHANGE: swarm.addrs now returns an array of objects { id: CID, addrs: Multiaddr[] } instead of PeerInfo instances.
BREAKING CHANGE: block.stat result now contains a cid property (whose value is a CID instance) instead of a key property.
BREAKING CHANGE: bitswap.wantlist now returns an array of CID instances.
BREAKING CHANGE: bitswap.stat result has changed - wantlist and peers values are now an array of CID instances.
v41.0.1
chore: release version v41.0.1
v41.0.0
v40.2.1
chore: release version v40.2.1
v40.2.0
v40.1.0
v40.0.1
v40.0.0
Code Refactoring
- async await roundup (#1173) (3e5967a), closes #1103
- convert config API to async await (#1155) (621973c)
- move files to root level (#1150) (559a97d)
Features
Reverts
BREAKING CHANGES
- The
log.tailmethod now returns an async iterator that yields log messages. Use it like:for await (const message of ipfs.log.tail()) { console.log(message) }
- The response to a call to
log.levelnow returns an object that has camel cased keys. i.e.MessageandErrorproperties have changed tomessageanderror. - Dropped support for go-ipfs <= 0.4.4 in
swarm.peersresponse. - The signature for
ipfs.mounthas changed fromipfs.mount([ipfsPath], [ipnsPath])toipfs.mount([options]). Whereoptionsis an optional object that may contain two boolean propertiesipfsPathandipnsPath. The response object has also changed to be camel case. See https://docs.ipfs.io/reference/api/http/#api-v0-mount. - Default ping
countof 1 in client has been removed. The default ping count is now whatever the IPFS node defaults it to (currently 10). If you specifically need 1 ping message then please passcount: 1in options foripfs.ping(). - Multi parameter constructor options are no longer supported. To create a new IPFS HTTP client, pass a single parameter to the constructor. The parameter can be one of:
- String, formatted as one of:
- Multiaddr e.g. /ip4/127.0.0.1/tcp/5001
- URL e.g. http://127.0.0.1:5001
- Multiaddr instance
- Object, in format of either:
- Address and path e.g.
{ apiAddr: '/ip4/127.0.0.1/tcp/5001': apiPath: '/api/v0' }(Note:apiAddrcan also be a string in URL form or a Multiaddr instance) - Node.js style address e.g.
{ host: '127.0.0.1', port: 5001, protocol: 'http' }
- Address and path e.g.
- String, formatted as one of:
- Errors returned from request failures are now all
HTTPErrors which carry aresponseproperty. This is aResponsethat can be used to inspect all information relating to the HTTP response. This means that theerr.statusorerr.statusCodeproperty should now be accessed viaerr.response.status. - files in
src/files-regularhave moved tosrc. Thesrc/files-mfsdirectory has been renamed tosrc/files. If you were previously requiring files from these directories e.g.require('ipfs-http-client/src/files-regular/add')then please be aware that they have moved. - Kebab case options are no longer supported. Please use camel case option names as defined in the
interface-ipfs-coredocs. e.g. theallow-offlineoption toname.publishshould be passed asallowOffline.- Note that you can pass additional query string parameters in the
searchParamsoption available to all API methods.
- Note that you can pass additional query string parameters in the