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

39 lines (32 loc) 1.08 kB
const StorageSystem = require ('./storage-system'); const Cloudinary = require('cloudinary').v2; class CloudinaryStorageSystem extends StorageSystem { /** * @memberof NFSStorage * @name Upload * @params filename, destination * @description Serves as General Upload SDK for NFS Storage */ constructor() { super(); } async upload(bucketName, filename, fileType) { try { await Cloudinary.uploader.upload(filename, { resource_type: fileType, folder: bucketName, chunk_size: 6000000, eager: [ { width: 300, height: 300, crop: "pad", audio_codec: "none" }, { width: 160, height: 100, crop: "crop", gravity: "south", audio_codec: "none" } ], eager_async: true, }, function(error, result) { return (result) }); } catch (err) { return new Error(err); } } } module.exports = CloudinaryStorageSystem;