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
callbackify
on API methods that return Promises to emulate previous behaviour. See the migration guide for more info. -
add
now returns an async iterable. -
add
now acceptsmode
andmtime
options on inputs to allow setting mode and mtime metadata for added files. See the core interface docs for more info. -
add
results now contain acid
property (a CID instance) instead of a stringhash
property. -
🆕
add
results now includemode
andmtime
properties if they were set. -
addReadableStream
,addPullStream
have been removed. Please see the migration guide for more info. -
addFromStream
has been removed. Useadd
instead. -
addFromFs
has been removed. Please use the exportedglobSource
utility and pass the result toadd
. See the glob source documentation for more details and an example. -
addFromURL
has been removed. Please use the exportedurlSource
utility and pass the result toadd
. See the URL source documentation for more details and an example. -
bitswap.stat
result has changed -wantlist
and values are now an array of CID instances andpeers
is now astring[]
of peer IDs. -
bitswap.wantlist
now returns an array of CID instances. -
block.rm
now returns an async iterable. -
block.rm
now yields objects of{ cid: CID, error: Error }
. -
block.stat
result now contains acid
property (whose value is a CID instance) instead of akey
property. -
dht.findProvs
,dht.provide
,dht.put
anddht.query
now all return an async iterable. -
dht.findPeer
,dht.findProvs
,dht.provide
,dht.put
anddht.query
now yield/return an object{ id: string, addrs: Multiaddr[] }
instead of aPeerInfo
instance(s). -
🆕
files.chmod
has been added. See the core interface docs for info. -
🆕
files.flush
now returns the root CID for the path that was flushed (/
by default) -
files.lsPullStream
andfiles.lsReadableStream
have been removed. Please see the migration guide for more info. -
files.ls
now returns an async iterable. -
files.ls
results now contain acid
property (whose value is a CID instance) instead of ahash
property. -
🆕
files.ls
results now includemode
andmtime
properties if they were set. See the core interface docs for more info. -
files.ls
no longer takes along
option (in core) - you will receive all data by default. -
🆕
files.mkdir
now acceptsmode
andmtime
options to allow setting mode and mtime metadata. See the core interface docs for more info. -
files.readPullStream
andfiles.readReadableStream
have been removed. Please see the migration guide for more info. -
files.read
now returns an async iterable. -
files.stat
result now contains acid
property (whose value is a CID instance) instead of ahash
property. -
🆕
files.stat
result now includesmode
andmtime
properties if they were set. See the core interface docs for more info. -
🆕
files.touch
has been added. See the core interface docs for info. -
🆕
files.write
now acceptsmode
andmtime
options to allow setting mode and mtime metadata. See the core interface docs for more info. -
get
now returns an async iterable. Thecontent
property value for objects yielded from the iterator is now an async iterable that yieldsBufferList
objects. -
id
result has changed, theaddresses
property is now aMultiaddr[]
-
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 useit-last
to extract it like so:const last = require('it-last') await last(ipfs.name.resolve('/ipns/QmHash'))
-
🆕
object.get
now accepts atimeout
option. It will cause the method to throw with aTimeoutError
if no data is received within the timeout window. It can be passed as anumber
or astring
. If anumber
is passed it is interpreted as milliseconds, if a string is passed it is interpreted as a human readable duration. -
ls
now returns an async iterable. -
ls
results now contain acid
property (whose value is a CID instance) instead of ahash
property. -
ls
results now includemode
andmtime
properties if they were set. See the core interface docs for more info. -
pin.add
results now contain acid
property (a CID instance) instead of a stringhash
property. -
🆕
pin.add
now accepts atimeout
option. It will cause the method to throw with aTimeoutError
if no data is received within the timeout window. It can be passed as anumber
or astring
. If anumber
is passed it is interpreted as milliseconds, if a string is passed it is interpreted as a human readable duration. -
pin.ls
now returns an async iterable. -
pin.ls
results now contain acid
property (a CID instance) instead of a stringhash
property. -
pin.rm
results now contain acid
property (a CID instance) instead of a stringhash
property. -
ping
now returns an async iterable. -
refs
andrefs.local
now return an async iterable. -
🆕
refs
now accepts atimeout
option. It will cause the method to throw with aTimeoutError
if no data is received within the timeout window. It can be passed as anumber
or astring
. If anumber
is passed it is interpreted as milliseconds, if a string is passed it is interpreted as a human readable duration. -
repo.gc
now returns an async iterable. -
stats.bw
now returns an async iterable. -
swarm.peers
now returns an array of objects with apeer
property that is astring
, instead of aPeerId
instance. -
swarm.addrs
now returns an array of objects{ id: string, addrs: Multiaddr[] }
instead ofPeerInfo
instances.
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.tail
method 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.level
now returns an object that has camel cased keys. i.e.Message
andError
properties have changed tomessage
anderror
. - Dropped support for go-ipfs <= 0.4.4 in
swarm.peers
response. - The signature for
ipfs.mount
has changed fromipfs.mount([ipfsPath], [ipnsPath])
toipfs.mount([options])
. Whereoptions
is an optional object that may contain two boolean propertiesipfsPath
andipnsPath
. The response object has also changed to be camel case. See https://docs.ipfs.io/reference/api/http/#api-v0-mount. - Default ping
count
of 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: 1
in 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:apiAddr
can 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
HTTPError
s which carry aresponse
property. This is aResponse
that can be used to inspect all information relating to the HTTP response. This means that theerr.status
orerr.statusCode
property should now be accessed viaerr.response.status
. - files in
src/files-regular
have moved tosrc
. Thesrc/files-mfs
directory 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-core
docs. e.g. theallow-offline
option toname.publish
should be passed asallowOffline
.- Note that you can pass additional query string parameters in the
searchParams
option available to all API methods.
- Note that you can pass additional query string parameters in the