Files
stacks.js/docs/classes/storage.storage-1.html
2021-06-28 10:27:07 -07:00

773 lines
46 KiB
HTML
Vendored

<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Storage | Stacks.js 1.4.1 Library Reference</title>
<meta name="description" content="Documentation for Stacks.js 1.4.1 Library Reference">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<script async src="../assets/js/search.js" id="search-script"></script>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">Stacks.js 1.4.1 Library Reference</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../modules.html">Stacks.js 1.4.1 Library Reference</a>
</li>
<li>
<a href="../modules/storage.html">storage</a>
</li>
<li>
<a href="storage.storage-1.html">Storage</a>
</li>
</ul>
<h1>Class Storage</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">Storage</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="storage.storage-1.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class"><a href="storage.storage-1.html#usersession" class="tsd-kind-icon">user<wbr>Session</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#deletefile" class="tsd-kind-icon">delete<wbr>File</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#getappbucketurl" class="tsd-kind-icon">get<wbr>App<wbr>Bucket<wbr>Url</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#getfile" class="tsd-kind-icon">get<wbr>File</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#getfilecontents" class="tsd-kind-icon">get<wbr>File<wbr>Contents</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#getfilesignedunencrypted" class="tsd-kind-icon">get<wbr>File<wbr>Signed<wbr>Unencrypted</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#getfileurl" class="tsd-kind-icon">get<wbr>File<wbr>Url</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#getgaiaaddress" class="tsd-kind-icon">get<wbr>Gaia<wbr>Address</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#getuserappfileurl" class="tsd-kind-icon">get<wbr>User<wbr>App<wbr>File<wbr>Url</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#handlesignedencryptedcontents" class="tsd-kind-icon">handle<wbr>Signed<wbr>Encrypted<wbr>Contents</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#listfiles" class="tsd-kind-icon">list<wbr>Files</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="storage.storage-1.html#putfile" class="tsd-kind-icon">put<wbr>File</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>Storage<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><a href="../interfaces/storage.storageoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">StorageOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="storage.storage-1.html" class="tsd-signature-type" data-tsd-kind="Class">Storage</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L114">packages/storage/src/storage.ts:114</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>options: <a href="../interfaces/storage.storageoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">StorageOptions</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="storage.storage-1.html" class="tsd-signature-type" data-tsd-kind="Class">Storage</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="usersession" class="tsd-anchor"></a>
<h3>user<wbr>Session</h3>
<div class="tsd-signature tsd-kind-icon">user<wbr>Session<span class="tsd-signature-symbol">:</span> <a href="auth.usersession.html" class="tsd-signature-type" data-tsd-kind="Class">UserSession</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L114">packages/storage/src/storage.ts:114</a></li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="deletefile" class="tsd-anchor"></a>
<h3>delete<wbr>File</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">delete<wbr>File<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>wasSigned<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L631">packages/storage/src/storage.ts:631</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Deletes the specified file from the app&#39;s data store.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>path: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The path to the file to delete.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <span class="tsd-signature-symbol">{ </span>wasSigned<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span></h5>
<div class="tsd-comment tsd-typography">
<p>Optional options object.</p>
</div>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> was<wbr>Signed<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5>
<div class="tsd-comment tsd-typography">
<p>Set to true if the file was originally signed
in order for the corresponding signature file to also be deleted.</p>
</div>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
<p>Resolves when the file has been removed or rejects with an error.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getappbucketurl" class="tsd-anchor"></a>
<h3>get<wbr>App<wbr>Bucket<wbr>Url</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>App<wbr>Bucket<wbr>Url<span class="tsd-signature-symbol">(</span>gaiaHubUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, appPrivateKey<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L675">packages/storage/src/storage.ts:675</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Get the app storage bucket URL</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>gaiaHubUrl: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>the gaia hub URL</p>
</div>
</li>
<li>
<h5>appPrivateKey: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>the app private key used to generate the app address</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4>
<p>That resolves to the URL of the app index file
or rejects if it fails</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getfile" class="tsd-anchor"></a>
<h3>get<wbr>File</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>File<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/storage.getfileoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">GetFileOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ArrayBuffer</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L129">packages/storage/src/storage.ts:129</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Retrieves the specified file from the app&#39;s data store.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>path: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>the path to the file to read</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/storage.getfileoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">GetFileOptions</a></h5>
<div class="tsd-comment tsd-typography">
<p>a <a href="../interfaces/storage.getfileoptions.html">GetFileOptions</a> object</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ArrayBuffer</span><span class="tsd-signature-symbol">&gt;</span></h4>
<p>that resolves to the raw data in the file
or rejects with an error</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getfilecontents" class="tsd-anchor"></a>
<h3>get<wbr>File<wbr>Contents</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>File<wbr>Contents<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, app<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, username<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span>, zoneFileLookupURL<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span>, forceText<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ArrayBuffer</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L274">packages/storage/src/storage.ts:274</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>path: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>app: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>username: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>zoneFileLookupURL: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>forceText: <span class="tsd-signature-type">boolean</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ArrayBuffer</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getfilesignedunencrypted" class="tsd-anchor"></a>
<h3>get<wbr>File<wbr>Signed<wbr>Unencrypted</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>File<wbr>Signed<wbr>Unencrypted<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, opt<span class="tsd-signature-symbol">: </span><a href="../interfaces/storage.getfileoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">GetFileOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ArrayBuffer</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L316">packages/storage/src/storage.ts:316</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>path: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>opt: <a href="../interfaces/storage.getfileoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">GetFileOptions</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ArrayBuffer</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getfileurl" class="tsd-anchor"></a>
<h3>get<wbr>File<wbr>Url</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>File<wbr>Url<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/storage.getfileurloptions.html" class="tsd-signature-type" data-tsd-kind="Interface">GetFileUrlOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L246">packages/storage/src/storage.ts:246</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Get the URL for reading a file from an app&#39;s data store.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>path: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>the path to the file to read</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/storage.getfileurloptions.html" class="tsd-signature-type" data-tsd-kind="Interface">GetFileUrlOptions</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4>
<p>that resolves to the URL or rejects with an error</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getgaiaaddress" class="tsd-anchor"></a>
<h3>get<wbr>Gaia<wbr>Address</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>Gaia<wbr>Address<span class="tsd-signature-symbol">(</span>app<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, username<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, zoneFileLookupURL<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L219">packages/storage/src/storage.ts:219</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>app: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> username: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> zoneFileLookupURL: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getuserappfileurl" class="tsd-anchor"></a>
<h3>get<wbr>User<wbr>App<wbr>File<wbr>Url</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>User<wbr>App<wbr>File<wbr>Url<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, username<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, appOrigin<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, zoneFileLookupURL<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L196">packages/storage/src/storage.ts:196</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Fetch the public read URL of a user file for the specified app.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>path: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>the path to the file to read</p>
</div>
</li>
<li>
<h5>username: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The Blockstack ID of the user to look up</p>
</div>
</li>
<li>
<h5>appOrigin: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The app origin</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> zoneFileLookupURL: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4>
<p>that resolves to the public read URL of the file
or rejects with an error</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="handlesignedencryptedcontents" class="tsd-anchor"></a>
<h3>handle<wbr>Signed<wbr>Encrypted<wbr>Contents</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">handle<wbr>Signed<wbr>Encrypted<wbr>Contents<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, storedContents<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, app<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, privateKey<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, username<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, zoneFileLookupURL<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L394">packages/storage/src/storage.ts:394</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>path: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>storedContents: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>app: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> privateKey: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> username: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> zoneFileLookupURL: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="listfiles" class="tsd-anchor"></a>
<h3>list<wbr>Files</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">list<wbr>Files<span class="tsd-signature-symbol">(</span>callback<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L782">packages/storage/src/storage.ts:782</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>List the set of files in this application&#39;s Gaia storage bucket.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>callback: <span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">boolean</span></h5>
<div class="tsd-comment tsd-typography">
<p>a callback to invoke on each named file that
returns <code>true</code> to continue the listing operation or <code>false</code> to end it.
If the call is ended early by the callback, the last file is excluded.
If an error occurs the entire call is rejected.</p>
</div>
<ul class="tsd-parameters">
<li class="tsd-parameter-signature">
<ul class="tsd-signatures tsd-kind-type-literal">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>name: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">&gt;</span></h4>
<p>that resolves to the number of files listed</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="putfile" class="tsd-anchor"></a>
<h3>put<wbr>File</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">put<wbr>File<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, content<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Blob</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ArrayBufferView</span>, options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/storage.putfileoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">PutFileOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/blockstack/stacks.js/blob/master/packages/storage/src/storage.ts#L465">packages/storage/src/storage.ts:465</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Stores the data provided in the app&#39;s data store to to the file specified.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>path: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>the path to store the data in</p>
</div>
</li>
<li>
<h5>content: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Blob</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ArrayBufferView</span></h5>
<div class="tsd-comment tsd-typography">
<p>the data to store in the file</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/storage.putfileoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">PutFileOptions</a></h5>
<div class="tsd-comment tsd-typography">
<p>a <a href="../interfaces/storage.putfileoptions.html">PutFileOptions</a> object</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4>
<p>that resolves if the operation succeed and rejects
if it failed</p>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=" ">
<a href="../modules.html">Modules</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/auth.html">auth</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/bns.html">bns</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/cli.html">cli</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/common.html">common</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/encryption.html">encryption</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/keychain.html">keychain</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/network.html">network</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/profile.html">profile</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/stacking.html">stacking</a>
</li>
<li class="current tsd-kind-module">
<a href="../modules/storage.html">storage</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/transactions.html">transactions</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-module">
<a href="../modules/auth.html" class="tsd-kind-icon">auth</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/bns.html" class="tsd-kind-icon">bns</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/cli.html" class="tsd-kind-icon">cli</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/common.html" class="tsd-kind-icon">common</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/encryption.html" class="tsd-kind-icon">encryption</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/keychain.html" class="tsd-kind-icon">keychain</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/network.html" class="tsd-kind-icon">network</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/profile.html" class="tsd-kind-icon">profile</a>
</li>
<li class=" tsd-kind-module">
<a href="../modules/stacking.html" class="tsd-kind-icon">stacking</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-module">
<a href="../modules/storage.html" class="tsd-kind-icon">storage</a>
<ul>
<li class="current tsd-kind-class tsd-parent-kind-module">
<a href="storage.storage-1.html" class="tsd-kind-icon">Storage</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="storage.storage-1.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="storage.storage-1.html#usersession" class="tsd-kind-icon">user<wbr>Session</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#deletefile" class="tsd-kind-icon">delete<wbr>File</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#getappbucketurl" class="tsd-kind-icon">get<wbr>App<wbr>Bucket<wbr>Url</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#getfile" class="tsd-kind-icon">get<wbr>File</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#getfilecontents" class="tsd-kind-icon">get<wbr>File<wbr>Contents</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#getfilesignedunencrypted" class="tsd-kind-icon">get<wbr>File<wbr>Signed<wbr>Unencrypted</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#getfileurl" class="tsd-kind-icon">get<wbr>File<wbr>Url</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#getgaiaaddress" class="tsd-kind-icon">get<wbr>Gaia<wbr>Address</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#getuserappfileurl" class="tsd-kind-icon">get<wbr>User<wbr>App<wbr>File<wbr>Url</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#handlesignedencryptedcontents" class="tsd-kind-icon">handle<wbr>Signed<wbr>Encrypted<wbr>Contents</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#listfiles" class="tsd-kind-icon">list<wbr>Files</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="storage.storage-1.html#putfile" class="tsd-kind-icon">put<wbr>File</a>
</li>
</ul>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-module">
<a href="../interfaces/storage.gaiahubconfig.html" class="tsd-kind-icon">Gaia<wbr>Hub<wbr>Config</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-module">
<a href="../interfaces/storage.getfileoptions.html" class="tsd-kind-icon">Get<wbr>File<wbr>Options</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-module">
<a href="../interfaces/storage.getfileurloptions.html" class="tsd-kind-icon">Get<wbr>File<wbr>Url<wbr>Options</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-module">
<a href="../interfaces/storage.putfileoptions.html" class="tsd-kind-icon">Put<wbr>File<wbr>Options</a>
</li>
<li class=" tsd-kind-interface tsd-parent-kind-module">
<a href="../interfaces/storage.storageoptions.html" class="tsd-kind-icon">Storage<wbr>Options</a>
</li>
<li class=" tsd-kind-function tsd-parent-kind-module">
<a href="../modules/storage.html#deletefromgaiahub" class="tsd-kind-icon">delete<wbr>From<wbr>Gaia<wbr>Hub</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-module">
<a href="../modules/transactions.html" class="tsd-kind-icon">transactions</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>