Nirvana Playing Madonna

    skipper-postgresql

    0.50.0 • Public • Published

    skipper-postgreql adapter

    NPM version Build status Dependency Status Code Climate

    Streaming Uploads/Downloads using Sails.js and PostgreSQL.

    Install

    $ npm install skipper-postgresql --save

    Usage

    config/skipper.js

    module.exports.skipper = {
      adapter: require('skipper-postgresql'),
      connection: {
        host: 'localhost',
        user: 'postgres',
        password: 'postgres'
      },
     
      /**
       * OR
       *
      connection: 'postgres://postgres:postgres@localhost:5432/postgres'
       */
     
       /**
        * table to store files in
        */
       fileTable: 'file'
    }

    api/controllers/FileController.js

    module.exports = {
      upload: function (req, res) {
        req.file('upload').upload(sails.config.skipper, function (err, files) {
          if (err) return res.negotiate(err);
     
          res.ok(files)
        })
      },
      download: function (req, res) {
        var SkipperAdapter = sails.config.skipper.adapter;
        SkipperAdapter(sails.config.skipper).read(req.param('fd'), function (err, file) {
          if (err) return res.negotiate(err);
     
          res.send(new Buffer(file))
        })
      }
    }

    License

    MIT

    Maintained By

    Install

    npm i skipper-postgresql

    DownloadsWeekly Downloads

    6

    Version

    0.50.0

    License

    MIT

    Last publish

    Collaborators