read-symbolic-link.js 342 B

1234567891011121314151617181920
  1. 'use strict';
  2. var fs = require('graceful-fs');
  3. function readLink(file, optResolver, onRead) {
  4. fs.readlink(file.path, onReadlink);
  5. function onReadlink(readErr, target) {
  6. if (readErr) {
  7. return onRead(readErr);
  8. }
  9. // Store the link target path
  10. file.symlink = target;
  11. onRead();
  12. }
  13. }
  14. module.exports = readLink;