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

Function moveOrCopy

src/fileSystem/internalFs.js:208–224  ·  view source on GitHub ↗

* Move or copy a file or directory to another location * @param {"copyTO"|"moveTo"} action * @param {string} src * @param {string} dest * @returns {Promise } The new location of the file or directory

(action, src, dest)

Source from the content-addressed store, hash-verified

206 * @returns {Promise<string>} The new location of the file or directory
207 */
208 moveOrCopy(action, src, dest) {
209 return new Promise((resolve, reject) => {
210 reject = setMessage(reject);
211 this.verify(src, dest)
212 .then((res) => {
213 const { src, dest } = res;
214
215 src[action](
216 dest,
217 undefined,
218 (entry) => resolve(decodeURIComponent(entry.nativeURL)),
219 reject,
220 );
221 })
222 .catch(reject);
223 });
224 },
225
226 /**
227 * Return the stats of a file or directory

Callers 2

copyFunction · 0.85
moveFunction · 0.85

Calls 3

resolveFunction · 0.85
verifyMethod · 0.80
setMessageFunction · 0.70

Tested by

no test coverage detected