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

Function verify

src/fileSystem/internalFs.js:267–301  ·  view source on GitHub ↗

* Verify if a file or directory exists * @param {string} src * @param {string} dest * @returns {Promise<{src:Entry, dest:Entry}>}

(src, dest)

Source from the content-addressed store, hash-verified

265 * @returns {Promise<{src:Entry, dest:Entry}>}
266 */
267 verify(src, dest) {
268 return new Promise((resolve, reject) => {
269 reject = setMessage(reject);
270 window.resolveLocalFileSystemURL(
271 src,
272 (srcEntry) => {
273 window.resolveLocalFileSystemURL(
274 dest,
275 (destEntry) => {
276 window.resolveLocalFileSystemURL(
277 Url.join(destEntry.nativeURL, srcEntry.name),
278 (res) => {
279 reject({
280 code: 12,
281 });
282 },
283 (err) => {
284 if (err.code === 1) {
285 resolve({
286 src: srcEntry,
287 dest: destEntry,
288 });
289 } else {
290 reject(err);
291 }
292 },
293 );
294 },
295 reject,
296 );
297 },
298 reject,
299 );
300 });
301 },
302
303 /**
304 * Check if a file or directory exists

Callers

nothing calls this directly

Calls 2

resolveFunction · 0.85
setMessageFunction · 0.70

Tested by

no test coverage detected