UNPKG

node_storage_manager

Version:

Node - Storage Pipe Manager allows world-wide storage and retrieval of any amount of data at any time. You can use Google Cloud Storage, AWS S3 Bucket for a range of scenarios including serving website content, storing data for archival and disaster recov

35 lines (32 loc) 1.1 kB
const GCLOUD = require('./lib/GoogleCloudStorageSystem'); const NFS = require('./lib/NFSStorageSystem'); const AWS3 = require('./lib/S3StorageSystem'); const CLOUDINARY = require('./lib/CloudinaryStorageSystem'); const DG = require('./lib/DigitalOceanStorageSystem'); class StorageFactory { static getInstance(storageMode, Region) { if (!storageMode) { throw new Error('Please add a storage Instance'); } if (storageMode === 'GCLOUD') { return new GCLOUD(); } else if (storageMode === 'AWS') { return new AWS3(Region); } else if (storageMode === 'NFS') { return new NFS(); } else if (storageMode === 'CLOUDINARY') { return new CLOUDINARY(); } else if (storageMode === 'DG') { return new DG(Region); } else { throw new Error(`Cant recognize instance of ${storageMode}, Please Specify Instance of AWS, GCLOUD, NFS`); } } } const storageSystem = StorageFactory; module.exports = storageSystem;