Shypyard Files

Shypyard App Filestorage

You can also use the files methods to store files on Shypyard.

const shypyard = libs.shypyard.get();

const fileName = 'test.txt';

// Upload file
// files.upload({key: string, data: string | Buffer})
await shypyard.files.upload({ key: fileName, data: 'test' });

// Get file
// files.get({key: string})
const data = await shypyard.files.get({ key: fileName });

// Get file downloadable link (with expiration)
// files.getDownloadableURL({key: string})
const link = await shypyard.files.getDownloadableURL({key: fileName});

// Get file meta information (i.e. size)
// files.getMeta({key: string});
const {size, md5, lastModified} = await shypyard.files.getMeta({ key: fileName });

// Delete file
// files.delete({key: string});
const shypyard.files.delete({key: fileName});

// List files
// shypyard.files.list({prefix: string, recursive?: boolean, limit?: number, cursor?: string});
const {data, hasMore, nextCursor} = shypyard.files.list({ prefix: key });

Last updated