Assets Provider
The Assets provider allows you to store and retrieve objects on the Vonage Cloud Runtime platform. You can generate links to your public files, with TTLs for secure files, or download the binary.
Functions
createDir- this allows you to create a directory ahead of uploading files. See the code snippet here.uploadFiles- this allows you to upload files from your project to the Vonage Cloud Runtime platform for long-term storage. See the code snippet here.remove- this allows you to remove a file or directory that you have previously uploaded or created. See the code snippet here.list- this allows you to list files and directories that are available in your project. See the code snippet here.generateLink- this allows you to generate a link to a file that is publicly accessible. See the code snippet here.getRemoteFile- this allows you to download a file you have previously uploaded in its binary/raw form. See the code snippet here.
Initializing the Assets Provider
To use the Assets Provider you need to create an instance of the provider using a session:
Usage
For example to use the Assets provider to upload a file from a HTML form using busboy:
Then to retrieve the file:
Or to generate a link to the file: