Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^0.36.4
->^0.50.0
Release Notes
ipfs/js-ipfs
v0.50.2
Compare Source
Note: Version bump only for package ipfs
v0.50.1
Compare Source
fix: Downgrade merge-options to restore node 12 compat when engine-strict is true #3271
v0.50.0
Compare Source
Features
v0.49.1
Compare Source
Bug Fixes
v0.49.0
Compare Source
Bug Fixes
Features
BREAKING CHANGES
v0.48.2
Compare Source
Note: Version bump only for package ipfs
v0.48.1
Compare Source
Bug Fixes
v0.48.0
Compare Source
Bug Fixes
Features
Breaking Changes
ipfs.add
only works on single items - a Uint8Array, a String, an AsyncIterable etcipfs.addAll
works on multiple itemsipfs.dag.resolve
returnsPromise<{ cid, remainderPath }
instead ofAsyncIterator<{ value, remainderPath }>
ipfs.bitswap.wantlist([peer], [options])
is split into:ipfs.bitswap.wantlist([options])
ipfs.bitswap.wantlistForPeer(peer, [options])
ipfs.bootstrap.add([addr], [options])
is split into:ipfs.bootstrap.add(addr, [options])
- add a bootstrap nodeipfs.bootstrap.reset()
- restore the default list of bootstrap nodesipfs.bootstrap.rm([addr], [options])
is split into:ipfs.bootstrap.rm(addr, [options])
- remove a bootstrap nodeipfs.bootstrap.clear([options])
- empty the bootstrap listipfs.dag.get(cid, [path], [options])
becomesipfs.dag.get(cid, [options])
path
is moved into theoptions
objectipfs.dag.tree(cid, [path], [options])
becomesipfs.dag.tree(cid, [options])
path
is moved into theoptions
objectipfs.dag.resolve(cid, [path], [options])
becomesipfs.dag.resolve(cid, [options])
path
is moved into theoptions
objectipfs.files.flush([path], [options])
becomesipfs.files.flush(path, [options])
ipfs.files.ls([path], [options])
becomesipfs.files.ls(path, [options])
ipfs.object.new([template], [options])
becomesipfs.object.new([options])
template
is moved into theoptions
objectipfs.pin.ls([paths], [options])
becomesipfs.pin.ls([options])
paths
is moved into theoptions
objectipfs.refs.local
now returns a v1 CID with the raw codec for every block and not the original CID by which it was added to the blockstorev0.47.0
Compare Source
Bug Fixes
Features
v0.46.1
Compare Source
Note: Version bump only for package ipfs
v0.46.0
Compare Source
Bug Fixes
ipfs.config.get([key,] [options])
-key
is optional again (#3069) (d043138)Features
ipfs.dag.get
for example) will now cause those blocks to be removed from your wantlist (ipfs/js-ipfs-bitswap#214)ipfs.dht.get(key, [options])
accepts a string or a buffer askey
(#3013) (0900bb9)Breaking Changes
Core API
ipfs.ls
no longer supports asort
option (#3013) (0900bb9)ipfs.key.gen
defaults to 2048 bit RSA keys (#3013) (0900bb9)CLI
ipfs files ls
no longer supports the-U
(unsorted) flag (#3013) (0900bb9)HTTP API
POST /api/v0/pin/list
no longer supports non-streaming responses (#3013) (0900bb9)HTTP API Client
ipfs.dht.get
resolves to a Buffer in line with the core api (#3013) (0900bb9)v0.45.0
Compare Source
Features
v0.44.0
Compare Source
Bug Fixes
Features
v0.43.3
Compare Source
Note: Version bump only for package ipfs
v0.43.2
Compare Source
Bug Fixes
v0.43.1
Compare Source
Bug Fixes
Features
v0.43.0
Compare Source
Bug Fixes
BREAKING CHANGES
Where we used to accept all and any HTTP methods, now only POST is
accepted. The API client will now only send POST requests too.
test: add tests to make sure we are post-only
chore: upgrade ipfs-utils
fix: return 405 instead of 404 for bad methods
fix: reject browsers that do not send an origin
Also fixes running interface tests over http in browsers against
js-ipfs
v0.42.1
Compare Source
Bug Fixes
v0.42.0
Compare Source
0.42.0 (2020-03-31)
Bug Fixes
chore
Features
BREAKING CHANGES
ipfs.files.stat(path)
was a hamt sharded dir, the resovledvalue returned by js-ipfs previously had a
type
property of with a value of'hamt-sharded-directory'
. To bring it in line with go-ipfs this value is now'directory'
.--cid-version=1
or
--raw-leaves=true
previously returned a CID that resolved toa raw node (e.g. a buffer). Returned CIDs now resolve to a
dag-pb
node that contains a UnixFS entry. This is to allow setting metadata
on small files with CIDv1.
v0.41.2
Compare Source
v0.41.1
Compare Source
Bug Fixes
v0.41.0
Compare Source
🔦 Highlights
🎶 In the jungle, the mighty jungle the lion sleeps tonight!
🎶 async await, async await, async await, async await...
We've completed a HUGE refactor to js-ipfs internals 🥳, switching to using Promises and
async
/await
over Callbacks and using async iterables instead of Node.js Streams and Pull Streams. Ok, I tell a lie, it's actually not just js-ipfs internals, it's the whole stack, including libp2p, IPLD and multiformats, you might call it a ground up re-write, but, you know, we don't like to brag.🚨 Oh, wait, serious note - this release brings big breaking changes to the core API so please consult the "API Changes" section below for all the information.
It's been a long and emotional voyage but this refactor brings a plethora of incredible immediate and future benefits to consumers, contributors and core developers that make all the work and effort worthwhile. To summarise, we've:
async
/await
so we’ll get better error stack traces and improved readability and maintainabilityUsing
async
/await
in JavaScript is gaining a lot of traction in the ecosystem and is rapidly becoming the de facto way of writing idiomatic JS. We want js-ipfs to move with the times and continue to be attractive to contributors by using modern JS features, techniques and practices. The big idea with these changes is for the code to be easier to contribute to, easier to understand, easier to maintain, and be faster and smaller than ever.This change is so big, and so significant, we wrote a whole blog post about it to explain the motivations behind the changes...in
excruciatingdelightful depth 🤣!We've also compiled some stats on this refactor for your viewing pleasure:
package.json
ipfs-http-client
browser bundle (unpkg.com/ipfs-http-client@41.0.1 vs unpkg.com/ipfs-http-client@42.0.0) - that's 60% smaller!ipfs-http-client
(net)...and a lot of those stats are just for js-ipfs and js-ipfs-http-client - the tip of the iceberg! We saw changes similar to this for between 60-70 dependencies across IPFS, libp2p, IPLD and multiformats.
🌗 UnixFS v1.5
Turns out, it's really important for package managers to retain file metadata, particularly last modified time (
mtime
). Filemtime
allows them to selectively sync only data that has changed. Up until now if you wanted to host a large data set on IPFS, like a package manager's repository, it would be difficult to update."What about the permanent web?" I hear you cry. Well, this absolutely doesn't prevent a particular snapshot of a package manager's repository from being permanently available. Metadata just enables diffs to be imported, instead of the whole thing. So, when I say "difficult to update", like I did up there, I mean slow and/or impossible. When you have Terabytes (or more) of package data and someone publishes a new package, it's kinda inconvenient to import everything again, when only a little part changed. File
mtime
is a really good indicator of which things have changed, so you can use it in IPFS now! 🥳For example, there's two new options to
jsipfs add
that allowmode
andmtime
to be preserved as the file is added to IPFS:Ok, no big changes there aside from the new options, buuut, now when you list directory contents you get
Mode
andMtime
info:Rad right!?
Persisting the file
mode
is also super rad, because it opens up NFS type use cases that weren't possible before. Imagine yournode_modules
directory is backed by IPFS and mounted on your file system - the filemode
will allow everything innode_modules/.bin
to be executable as you'd expect.The coolest thing about all of this is that it's completely backwards compatible. The CID for a given file/directory only changes if you opt in to metadata, otherwise the CIDs remain the same. Hooray!
There's a bunch of changes that add metadata capability to the CLI, HTTP and core API both for inputs and outputs. There's also a couple of new MFS commands
touch
andchmod
which allow you to change the metadata whenever you like! Magic 🧙♂️.See the API Changes sections below for details of all the new UnixFS v1.5 stuffs.
🏗 API Changes
Core API
There are significant and breaking core API changes in this release. Please see the migration guide.
IPFS is not a class that can be instantiated - use
IPFS.create
. An IPFS node instance is not an event emitter.The
init
option passed toIPFS.create
will now not take any initialization steps if it is set tofalse
. Previously, the repo would be initialized if it already existed. This is no longer the case. If you wish to initialize a node but only if the repo exists, passinit: { allowNew: false }
to the constructor.Instance
.ready
property has been removed. Please useIPFS.create
instead.IPFS.createNode
has been removed, please useIPFS.create
instead.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.Delegated peer and content routing modules are no longer included as part of core (but are still available if starting a js-ipfs daemon from the command line). If you wish to use delegated routing and are creating your node programmatically in Node.js or the browser you must
npm install libp2p-delegated-content-routing
and/ornpm install libp2p-delegated-peer-routing
and provide configured instances of them inoptions.libp2p
. See the module repos for further instructions: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:🆕
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.HTTP API
/api/v0/add
now supports the following additional multipart headers to allowmode
andmtime
metadata to be set on individual files:mode
file mode to apply to created UnixFS entries[string]
mtime
modification time in seconds before or since the Unix Epoch to apply to created UnixFS entries[number]
mtime-nsecs
modification time fraction in nanoseconds[number]
/api/v0/add
now returns fileMode
,Mtime
andMtimeNsecs
if set./api/v0/file/ls
has been removed, please use/api/v0/ls
instead./api/v0/files/chmod
has been added and supports the following query string args:arg
path of file to apply mode to[string]
mode
file mode to apply[string]
/api/v0/files/ls
now returns fileMode
,Mtime
andMtimeNsecs
if set./api/v0/files/mkdir
now supports supports the following additional query string args:mode
file mode to apply[string]
mtime
modification time in seconds before or since the Unix Epoch to apply[number]
/api/v0/files/stat
now returns fileMode
,Mtime
andMtimeNsecs
if set./api/v0/files/touch
has been added and supports the following query string args:arg
path of file to apply mode to[string]
mtime
modification time in seconds before or since the Unix Epoch to apply[number]
/api/v0/files/write
now supports the following additional multipart headers:mode
file mode to apply to created UnixFS entries[string]
mtime
modification time in seconds before or since the Unix Epoch to apply to created UnixFS entries[number]
/api/v0/ls
now returns fileMode
,Mtime
andMtimeNsecs
if set.CLI
jsipfs add [file...]
now supports the following flags to respect and applymode
andmtime
metadata of files added from the file system or explicitly set them:--preserve-mode
automatically apply permissions to created UnixFS entries from the file system[boolean] [default: false]
--preserve-mtime
automatically apply modification time to created UnixFS entries from the file system[boolean] [default: false]
--mode
file mode to apply to created UnixFS entries[string]
--mtime
modification time in seconds before or since the Unix Epoch to apply to created UnixFS entries[number]
--mtime-nsecs
modification time fraction in nanoseconds[number]
jsipfs file ls
has been removed, please usejsipfs ls
instead.jsipfs files chmod [mode] [path]
has been added.jsipfs files ls
now prints filemode
andmtime
.jsipfs files mkdir
now supports the following flags:--mode
file mode to apply to created UnixFS entries[string]
--mtime
modification time in seconds before or since the Unix Epoch to apply to created UnixFS entries[number]
jsipfs files stat
now prints filemode
andmtime
.jsipfs files touch [path]
has been added and supports the following flags:--mtime
modification time in seconds before or since the Unix Epoch to apply to created UnixFS entries[number]
jsipfs files write
now supports the following flags:--mode
file mode to apply to created UnixFS entries[string]
--mtime
modification time in seconds before or since the Unix Epoch to apply to created UnixFS entries[number]
jsipfs ls
now prints filemode
andmtime
.Other changes
websocket-star
multiaddrs should not be provided anymore in thejs-ipfs
configuration.❤️ Huge thank you to everyone that made this release possible
🙌🏽 Want to contribute?
Would you like to contribute to the IPFS project and don't know how? Well, there are a few places you can get started:
help wanted
label in the js-ipfs repoThe best place to ask your questions about IPFS, how it works and what you can do with it is at discuss.ipfs.io. We are also available at the
#ipfs
channel on Freenode.v0.40.0
Compare Source
🔦 Highlights
Ever worked on an application where you've had to write a database migration? Yeah, us too. Up until now js-ipfs hasn't been able to migrate repo's to a new format. Well, that's not strictly true, you could have used the go-ipfs repo migration tool on a repo created when running js-ipfs in Node.js (yes, we have repo compatibility!), but in the browser you were stuck.
..and I mean really stuck, if we'd updated the format of a repo that ships with js-ipfs then your applications would just have to catch an error that the repo version was not compatible. You couldn't use it, and you couldn't upgrade. Bad news bears 🐻.
We had a cunning strategy to avoid this situation - do not change the repo 😂, but this is rapidly becoming unsustainable since we actually want to add a migration to achieve our dream of base32 encoded v1 (by default) CIDs.
Good news friends! The new version of js-ipfs now ships with a repo migration tool that'll automatically migrate repo's in the browser. So now all our ducks are in a line, stay tuned for a migration and a switch to v1 CIDs ✨!
🎻 base32 encoded CIDs in IPNS paths
My violin strings gently weep for being able to use Peer IDs in a domain, and let me tell you why.
Peer IDs currently cannot be used in a domain name because their string format is
base58
- a case SENSITIVE encoding. In domain names the following are equivalent:So, bad times.
...but wait, Peer IDs ARE CIDs! I know, weird, but also rad because in theory we should be able to re-encode them as
base32
. Right now though, everything expects abase58
encoded string (a v0 CID) because they're actually just a multihash.In this js-ipfs release we've made a small change to allow you to take your Peer ID (a v0 CID), convert it to a base32 encoded v1 CID and use it in an IPNS path like
/ipns/bafybeidta3hkxk3ihxfsk765oswgsjhmvcnkeestyuov6r2t5tyts4xuoe
. You can take advantage of cid.ipfs.io (base32 version is provided for your convenience at the very bottom of the page) or do the conversion with the command line tools:This is really, seriously cool, because now Peer IDs can be used in domain names and so an IPFS gateway operating at
bafybeidta3hkxk3ihxfsk765oswgsjhmvcnkeestyuov6r2t5tyts4xuoe.ipns.dweb.link
for example, will have origin isolation (hooray for security 🔒) AND IPNS enabled mutable data 🚀⚡️To ease the transition we support CID v0 converted to v1 (with
dag-pb
multicodec). In the future, new Peer IDs will be v1 CIDs with self-describinglibp2p-key
codec that isbase32
encoded by default...but that's a change for another day.🌲 Implemented
dag put
anddag resolve
CLI commandsThese have been available in core for a while now and we finally got round to surfacing them in the CLI. e.g.
🏗 API Changes
dag.put
got apin
option to save you from calling the pin API separately (and potentially losing your node if GC runs inbetween!)❤️ Huge thank you to everyone that made this release possible
Renovate configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻️ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.