Shypyard Files

Shypyard App Filestorage

You can also use the files methods to store files on Shypyard.
1
const shypyard = libs.shypyard.get();
2
​
3
const fileName = 'test.txt';
4
​
5
// Upload file
6
// files.upload({key: string, data: string | Buffer})
7
await shypyard.files.upload({ key: fileName, data: 'test' });
8
​
9
// Get file
10
// files.get({key: string})
11
const data = await shypyard.files.get({ key: fileName });
12
​
13
// Get file downloadable link (with expiration)
14
// files.getDownloadableURL({key: string})
15
const link = await shypyard.files.getDownloadableURL({key: fileName});
16
​
17
// Get file meta information (i.e. size)
18
// files.getMeta({key: string});
19
const {size, md5, lastModified} = await shypyard.files.getMeta({ key: fileName });
20
​
21
// Delete file
22
// files.delete({key: string});
23
const shypyard.files.delete({key: fileName});
24
​
25
// List files
26
// shypyard.files.list({prefix: string, recursive?: boolean, limit?: number, cursor?: string});
27
const {data, hasMore, nextCursor} = shypyard.files.list({ prefix: key });
Copied!

​

Last modified 9mo ago
Copy link