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
Streaming Uploads/Downloads using Sails.js and PostgreSQL.
Install
$ npm install skipper-postgresql --saveUsage
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
