caver.ipfs
Last updated
Last updated
caver.ipfs
is a package that provides functionality related to IPFS (InterPlanetary File System).
NOTE caver.ipfs
is supported since caver-js v1.5.4.
Initializes a connection with an IPFS Node. When an IPFS Node information is set through this function, you can upload files to IPFS or load files from IPFS.
Parameters
Name | Type | Description |
---|---|---|
Return Value
None
Example
Adds a file to IPFS. The CID(Content Identifier) of the uploaded file is returned.
If the path of a file is passed, the contents of the file are loaded from the path and uploaded to IPFS. If a buffer is passed, it is uploaded to IPFS directly.
Parameters
NOTE Buffer
is supported since caver-js v1.5.5.
Return Value
Promise
returns string
Example
Returns a file addressed by a valid IPFS path.
Parameters
Return Value
Promise
returns Buffer
Example
Converts a CID(Content Identifier) to a Multihash.
Parameters
Return Value
Example
Converts to CID(Content Identifier) from a Multihash.
Parameters
Return Value
Example
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
host
string
The IPFS Node url to connect with.
port
number
The port number to use.
ssl
boolean
If true, the https
protocol is used. Otherwise, the http
protocol is used.
data
string | Buffer | ArrayBuffer
The path string of a file or a buffer to add to IPFS.
string
The CID(Content Identifier) of the uploaded file.
hash
string
An CID(Content Identifier) of the file to download.
Buffer
The content of the file.
hash
string
A CID(Content Identifier) to convert.
string
The Multihash string.
hash
string
A Multihash to convert.
string