MCPcopy Create free account
hub / github.com/creationix/git-browser / chroot

Function chroot

src/old/git-webfs.js:17–39  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

15 return chroot;
16
17 function chroot(root) {
18 var exports = wrap(chroot);
19 exports.root = root;
20 exports.stat = wrap(stat);
21 exports.read = wrap(read);
22 exports.write = wrap(write);
23 exports.unlink = wrap(unlink);
24 exports.readlink = wrap(readlink);
25 exports.symlink = wrap(symlink);
26 exports.readdir = wrap(readdir);
27 exports.rmdir = wrap(rmdir);
28 exports.mkdir = wrap(mkdir);
29 exports.rename = wrap(rename, true);
30 return exports;
31
32 function wrap(fn, two) {
33 return function () {
34 arguments[0] = pathJoin(root, pathJoin("/", arguments[0]));
35 if (two) arguments[1] = pathJoin(root, pathJoin("/", arguments[1]));
36 return fn.apply(this, arguments);
37 };
38 }
39 }
40
41 // Given a path, return a continuable for the stat object.
42 function stat(path, callback) {

Callers

nothing calls this directly

Calls 1

wrapFunction · 0.85

Tested by

no test coverage detected