constputFileOptions = {// override the default content typecontentType:'application/json', // override encrypting data by default// you can also set encrypt to a private key to specify a custom encryption keyencrypt:false, // ignore automatic conflict prevention using etagsdangerouslyIgnoreEtag:true}storage.putFile('my_data.json', myData, putFileOptions));
constgetFileOptions = {decrypt:false,// by default files stored are signed and can be verified for authenticityverify:false}storage.getFile('my_data.json', getFileOptions).then((fileContent) => {console.log(fileContent);});
@stacks/storage
Store and fetch files with Gaia, the decentralized storage system.
Installation
Usage
Initiating a storage client
Note that you can also use an existing
userSession
object created during the authentication process.Put file
Store data at a different path
Put file with options
Get file
Get file with options
Delete file
Delete the file and the corresponding signature file if signed
List file
List all files in the user's Gaia hub