0.0.1 • Published 5 years ago
digital-ocean-sdk2 v0.0.1
digital-ocean-sdk
Digital-ocean-sdk is a semantic wrapper around aws-sdk with a few added functions.
Anything you cannot find in here can be found at aws-sdk documentation: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html
API
params
var params = {
Body: "file data here",
Bucket: "my-bucket-name",
Key: "filename",
FolderName: "folder", // added in our sdk
};
Upload file
Method: Storage.prototype.uploadFile
Upload a file to storage space.
Usage:
const uploadedFile = await storage.uploadFile(params);
Storage.prototype.uploadFileToDir
Upload a file to storage space at a certain directory. Do not forget to add FolderName
property on params if you need it to be in a folder.
Usage:
const uploadedFile = await storage.uploadFileToDir(params);
DO.Storage.prototype.listObjectsAsync
List all the objects, filtered by params. In params Bucket
is the only required property.
Usage:
const allObjects = await storage.listObjectsAsync(params);
Delete a file
Delete a file. FolderName
, Bucket
and Key
are required properties on params
.
Warning: Adding property Body
will cause the plugin to throw an error.
Usage:
await storage.deleteObjectAsync(params);
0.0.1
5 years ago