Skip to content

Commit 7e1a615

Browse files
committed
Added digital ocean spaces support
1 parent 278a2cf commit 7e1a615

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,26 @@ node_storage_manager allows you to switch between clients easily without reconfi
133133
}
134134
```
135135

136+
```javascript
137+
// Imports the node_storage_manager library
138+
const Storage = require('node_storage_manager');
139+
140+
// Set Storage Instance between AWS,GCLOUD and FS
141+
let StorageInstance = Storage.getInstance('DG', "Region e.g Asia");
142+
143+
/**
144+
* TODO(developer): Uncomment these variables before running the sample.
145+
*/
146+
// let bucketName = 'bucket-name';
147+
148+
async function download(bucketName) {
149+
// Creates the new bucket
150+
let result = await StorageInstance.upload(bucketName, 'filepath', 'image or video');
151+
console.log(result);
152+
// This way you can get all data returned from Cloudinary Client e.g result.url e.t.c
153+
}
154+
```
155+
136156
### Using the client library on `NFS`
137157
```javascript
138158
// Imports the node_storage_manager library

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const GCLOUD = require('./lib/GoogleCloudStorageSystem');
22
const NFS = require('./lib/NFSStorageSystem');
33
const AWS3 = require('./lib/S3StorageSystem');
44
const CLOUDINARY = require('./lib/CloudinaryStorageSystem');
5+
const DG = require('./lib/DigitalOceanStorageSystem');
56

67
class StorageFactory {
78
static getInstance(storageMode, Region) {
@@ -20,6 +21,9 @@ class StorageFactory {
2021
else if (storageMode === 'CLOUDINARY') {
2122
return new CLOUDINARY();
2223
}
24+
else if (storageMode === 'DG') {
25+
return new DG(Region);
26+
}
2327
else {
2428
throw new Error(`Cant recognize instance of ${storageMode}, Please Specify Instance of AWS, GCLOUD, NFS`);
2529
}

0 commit comments

Comments
 (0)