Create
With the Publish() methods you can upload your file on the Aleph network, if you only want to pin an IPFS hash you can refer to the Pin method.
Usage
Import the Store declaration to interact with the Publish function and the Item type to choose your storage location.
Then call the publishStore function, with the required parameters as follow:
Parameters
Parameter | Description |
---|---|
account - required Account | Account to use for signing. |
channel - required string | Channel of the message. Ideally, an application would decide and use one channel. |
fileObject - required file or blob | The file you want to store. |
storageEngine - optional ItemType | Storage engine to use, either Aleph storage or IPFS. Possible values: |
APIServer - optional string | The API server endpoint used to carry the request to Aleph's network. default: 'https://api2.aleph.im' |
Return
This will return an object like this:
Look at this message on Aleph Explorer! Download the file here.
Retrieve file via direct url
In the response, item_hash inside the content
filed can be used to retrieve the stored file via a direct URL as follow:
Via storageEngine.storage:
https://<API SERVER URL>/api/v0/storage/raw/<File Item Hash Here>
Via storageEngine.ipfs:
Or at the IPFS URL: https://ipfs.io/ipfs/<File Item Hash Here>
Last updated