index.js 467 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. var path = require('path')
  3. , fs = require('fs')
  4. , helper = require('./helper.js')
  5. ;
  6. module.exports = function(connInfo, cb) {
  7. var file = helper.getFileName();
  8. fs.stat(file, function(err, stat){
  9. if (err || !helper.usePgPass(stat, file)) {
  10. return cb(undefined);
  11. }
  12. var st = fs.createReadStream(file);
  13. helper.getPassword(connInfo, st, cb);
  14. });
  15. };
  16. module.exports.warnTo = helper.warnTo;