src/filesystem/interface.js
function wrappedGuidFn(context) {
    return function (callback) {
      // Skip the duplicate ID check if asked to
      if (flags.includes(FS_NODUPEIDCHECK)) {
        callback(null, guid());
        return;
      }

      // Otherwise (default) make sure this id is unused first
      function guidWithCheck(callback) {
        const id = guid();
        context.getObject(id, function (err, value) {
          if (err) {
            callback(err);
            return;
          }

          // If this id is unused, use it, otherwise find another
          if (!value) {
            callback(null, id);
          } else {
            guidWithCheck(callback);
          }
        });
      }
      guidWithCheck(callback);
    };
  }
function wrappedGuidFn(context) {
    return function (callback) {
      // Skip the duplicate ID check if asked to
      if (flags.includes(FS_NODUPEIDCHECK)) {
        callback(null, guid());
        return;
      }

      // Otherwise (default) make sure this id is unused first
      function guidWithCheck(callback) {
        const id = guid();
        context.getObject(id, function (err, value) {
          if (err) {
            callback(err);
            return;
          }

          // If this id is unused, use it, otherwise find another
          if (!value) {
            callback(null, id);
          } else {
            guidWithCheck(callback);
          }
        });
      }
      guidWithCheck(callback);
    };
  }
function wrappedGuidFn ( context ) { return function ( callback ) { // Skip the duplicate ID check if asked to if ( flags . includes ( FS_NODUPEIDCHECK ) ) { callback ( null , guid ( ) ) ; return ; } // Otherwise (default) make sure this id is unused first function guidWithCheck ( callback ) { const id = guid ( ) ; context . getObject ( id , function ( err , value ) { if ( err ) { callback ( err ) ; return ; } // If this id is unused, use it, otherwise find another if ( ! value ) { callback ( null , id ) ; } else { guidWithCheck ( callback ) ; } } ) ; } guidWithCheck ( callback ) ; } ; }
Deal with various approaches to node ID creation
Deal with various approaches to node ID creation