(file)
| 2 | var fs = require('./fs'); |
| 3 | |
| 4 | function validLink(file) { |
| 5 | // Ensures that a file is a symlink that points |
| 6 | // to a valid file |
| 7 | return Q.nfcall(fs.lstat, file) |
| 8 | .then(function(lstat) { |
| 9 | if (!lstat.isSymbolicLink()) { |
| 10 | return [false]; |
| 11 | } |
| 12 | |
| 13 | return Q.nfcall(fs.stat, file).then(function(stat) { |
| 14 | return [stat]; |
| 15 | }); |
| 16 | }) |
| 17 | .fail(function(err) { |
| 18 | return [false, err]; |
| 19 | }); |
| 20 | } |
| 21 | |
| 22 | module.exports = validLink; |
no outgoing calls
no test coverage detected
searching dependent graphs…