Lines Matching defs:fs

29 function patch (fs) {
36 patchLchmod(fs)
40 if (!fs.lutimes) {
41 patchLutimes(fs)
44 // https://github.com/isaacs/node-graceful-fs/issues/4
47 // that a fs doesn't support the intended operation.
49 fs.chown = chownFix(fs.chown)
50 fs.fchown = chownFix(fs.fchown)
51 fs.lchown = chownFix(fs.lchown)
53 fs.chmod = chmodFix(fs.chmod)
54 fs.fchmod = chmodFix(fs.fchmod)
55 fs.lchmod = chmodFix(fs.lchmod)
57 fs.chownSync = chownFixSync(fs.chownSync)
58 fs.fchownSync = chownFixSync(fs.fchownSync)
59 fs.lchownSync = chownFixSync(fs.lchownSync)
61 fs.chmodSync = chmodFixSync(fs.chmodSync)
62 fs.fchmodSync = chmodFixSync(fs.fchmodSync)
63 fs.lchmodSync = chmodFixSync(fs.lchmodSync)
65 fs.stat = statFix(fs.stat)
66 fs.fstat = statFix(fs.fstat)
67 fs.lstat = statFix(fs.lstat)
69 fs.statSync = statFixSync(fs.statSync)
70 fs.fstatSync = statFixSync(fs.fstatSync)
71 fs.lstatSync = statFixSync(fs.lstatSync)
74 if (fs.chmod && !fs.lchmod) {
75 fs.lchmod = function (path, mode, cb) {
78 fs.lchmodSync = function () {}
80 if (fs.chown && !fs.lchown) {
81 fs.lchown = function (path, uid, gid, cb) {
84 fs.lchownSync = function () {}
97 fs.rename = typeof fs.rename !== 'function' ? fs.rename
98 : (function (fs$rename) {
102 fs$rename(from, to, function CB (er) {
107 fs.stat(to, function (stater, st) {
109 fs$rename(from, to, CB);
121 if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename)
123 })(fs.rename)
127 fs.read = typeof fs.read !== 'function' ? fs.read
128 : (function (fs$read) {
136 return fs$read.call(fs, fd, buffer, offset, length, position, callback)
141 return fs$read.call(fs, fd, buffer, offset, length, position, callback)
144 // This ensures `util.promisify` works as it does for native `fs.read`.
145 if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read)
147 })(fs.read)
149 fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync
150 : (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
154 return fs$readSync.call(fs, fd, buffer, offset, length, position)
163 }})(fs.readSync)
165 function patchLchmod (fs) {
166 fs.lchmod = function (path, mode, callback) {
167 fs.open( path
177 fs.fchmod(fd, mode, function (err) {
178 fs.close(fd, function(err2) {
185 fs.lchmodSync = function (path, mode) {
186 var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
193 ret = fs.fchmodSync(fd, mode)
198 fs.closeSync(fd)
201 fs.closeSync(fd)
208 function patchLutimes (fs) {
209 if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
210 fs.lutimes = function (path, at, mt, cb) {
211 fs.open(path, constants.O_SYMLINK, function (er, fd) {
216 fs.futimes(fd, at, mt, function (er) {
217 fs.close(fd, function (er2) {
224 fs.lutimesSync = function (path, at, mt) {
225 var fd = fs.openSync(path, constants.O_SYMLINK)
229 ret = fs.futimesSync(fd, at, mt)
234 fs.closeSync(fd)
237 fs.closeSync(fd)
243 } else if (fs.futimes) {
244 fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
245 fs.lutimesSync = function () {}
252 return orig.call(fs, target, mode, function (er) {
263 return orig.call(fs, target, mode)
274 return orig.call(fs, target, uid, gid, function (er) {
285 return orig.call(fs, target, uid, gid)
308 return options ? orig.call(fs, target, options, callback)
309 : orig.call(fs, target, callback)
318 var stats = options ? orig.call(fs, target, options)
319 : orig.call(fs, target)
328 // ENOSYS means that the fs doesn't support the op. Just ignore