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

Function write

src/old/git-webfs.js:92–106  ·  view source on GitHub ↗
(path, value, mode, callback)

Source from the content-addressed store, hash-verified

90 }
91
92 function write(path, value, mode, callback) {
93 if (!callback) return write.bind(this, path, value, mode);
94 var errorHandler = wrapCallback(callback);
95 root.getFile(path, {create: true}, function (fileEntry) {
96 fileEntry.createWriter(function(fileWriter) {
97 fileWriter.onwriteend = function (evt) {
98 callback();
99 };
100 fileWriter.onerror = function (evt) {
101 callback(new Error("Write failed: " + evt.toString()));
102 };
103 fileWriter.write(new Blob([value]));
104 }, errorHandler);
105 }, errorHandler);
106 }
107
108 function unlink(path, callback) {
109 if (!callback) return unlink.bind(this, path);

Callers

nothing calls this directly

Calls 1

wrapCallbackFunction · 0.85

Tested by

no test coverage detected