-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdocs_sdk_get-file.html
94 lines (80 loc) · 2.77 KB
/
docs_sdk_get-file.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!-- Docs - SDK - getFile -->
<div class="section">
<h2><a href="/docs/">Docs</a> : <a href="/docs/sdk/">SDK</a> : getFile</h2>
<p><span class="font-semibold">getFile</span> lets you retrieve files uploaded via <a href="/docs/sdk/upload-file/">uploadFile</a>. You can retrieve entire files at a time, or retrieve partial files to stream them for example.</p>
<pre>
<code class="language-javascript">
userbase.getFile({
databaseName: 'example-database-name',
fileId: 'example-id'
}).then(({ file }) => {
// file object available
}).catch((e) => console.error(e))</code>
</pre>
<h3 id="params">Parameters</h3>
<ul>
<li>
<span class="field">databaseName</span> [string | Len: 1-100] - The database name to use.
</li>
<li>
<span class="field">fileId</span> [string | Len: 36] - The file's unique identifier.
</li>
<li>
<span class="field">range</span> [object | optional] - The range of bytes to retrieve.
<ul>
<li><span class="field">start</span> [number] - The first byte to retrieve inclusive.</li>
<li><span class="field">end</span> [number] - The last byte to retrieve exclusive.</li>
</ul>
</li>
</ul>
<h3 id="result">Result</h3>
<ul>
<li><span class="field">file</span> [File]</li>
</ul>
<h3 id="notes">Notes</h3>
<ul>
<li>
You can find a file's <span class="field">fileId</span> via <a href="/docs/sdk/open-database/">openDatabase</a>.
</li>
</ul>
<h3 id="advanced-params">Advanced Parameters</h3>
<ul>
<li>
<span class="field">shareToken</span> [string | optional] - The token used to access a shared database.
</li>
<li>
<span class="field">databaseId</span> [string | optional] - The database's unique identifier.
</li>
</ul>
<h3 id="errors">Errors</h3>
<ul>
<li>ParamsMustBeObject</li>
<li>DatabaseNotOpen</li>
<li>DatabaseNameMissing</li>
<li>DatabaseNameMustBeString</li>
<li>DatabaseNameCannotBeBlank</li>
<li>DatabaseNameTooLong</li>
<li>DatabaseNameRestricted</li>
<li>DatabaseIdMustBeString</li>
<li>DatabaseIdCannotBeBlank</li>
<li>DatabaseIdInvalidLength</li>
<li>DatabaseIdNotAllowed</li>
<li>DatabaseIsReadOnly</li>
<li>FileIdMissing</li>
<li>FileIdMustBeString</li>
<li>FileIdCannotBeBlank</li>
<li>FileIdTooLong</li>
<li>FileNotFound</li>
<li>RangeMissingStart</li>
<li>RangeMissingEnd</li>
<li>RangeStartMustBeNumber</li>
<li>RangeEndMustBeNumber</li>
<li>RangeStartMustBeGreaterThanZero</li>
<li>RangeEndMustBeGreaterThanRangeStart</li>
<li>RangeEndMustBeLessThanFileSize</li>
<li>UserNotSignedIn</li>
<li>TooManyRequests</li>
<li>ServiceUnavailable</li>
</ul>
</div>
<hr>