MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / createDir

Method createDir

src/fileSystem/sftp.js:136–162  ·  view source on GitHub ↗

* * @param {String} dirname

(dirname)

Source from the content-addressed store, hash-verified

134 * @param {String} dirname
135 */
136 createDir(dirname) {
137 dirname = Path.join(this.#path, dirname);
138 return new Promise((resolve, reject) => {
139 sftp.isConnected((connectionID) => {
140 (async () => {
141 if (this.#notConnected(connectionID)) {
142 try {
143 await this.connect();
144 } catch (error) {
145 reject(error);
146 return;
147 }
148 }
149
150 sftp.mkdir(
151 this.#safeName(dirname),
152 async (_res) => {
153 resolve(Url.join(this.#base, this.#safeName(dirname)));
154 },
155 (err) => {
156 reject(err);
157 },
158 );
159 })();
160 });
161 });
162 }
163
164 /**
165 * Write to a file on server

Callers

nothing calls this directly

Calls 6

#notConnectedMethod · 0.95
connectMethod · 0.95
#safeNameMethod · 0.95
resolveFunction · 0.85
mkdirMethod · 0.80
isConnectedMethod · 0.65

Tested by

no test coverage detected