JSPM

skipper-postgresql

0.50.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q24563F
  • License MIT

Skipper Adapter for PostgreSQL and Sails

Package Exports

  • skipper-postgresql

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (skipper-postgresql) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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