0.2.3 • Published 7 years ago

multer-gcloud v0.2.3

Weekly downloads
13
License
MIT
Repository
github
Last release
7 years ago

multer-gcloud

A storage module for connect gcloud with multer

Install

    $ npm install --save multer-gcloud

Config

var multer_gcloud = require('multer-gcloud');

var gcloud = require('@google-cloud/storage')({
  projectId: '<projectId>',
  keyFilename: '<google-cloud-service.json>'
});

var bucket = gcloud.bucket('<storageBucket>');

const storage = multer_gcloud({
  storage_bucket: '<storageBucket>',
  bucket: bucket,
  metadata: function (req, file, cb) {
    cb(null, file.mimetype);
  },
  destination: function (req, file, cb) {
    cb(null, 'uploads');
  },
  filename: function (req, file, cb) {
    cb(null, + Date.now() + '.' + ext(file.originalname));
  }
});

const upload = multer({ storage: storage }).single('picture');
0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago