Member Junction
    Preparing search index...
    • Lists objects (files) and prefixes (directories) in a storage provider at the specified path.

      This utility function provides access to the storage provider's file and folder listing functionality. It returns both files and directories found at the specified path prefix, allowing for hierarchical navigation through the storage provider's contents.

      Parameters

      • providerEntity: MJFileStorageProviderEntity

        The file storage provider entity containing connection details

      • prefix: string

        The path prefix to list objects from (e.g., "/" for root, "documents/" for a specific folder)

      • delimiter: string = '/'

        The character used to group keys into a hierarchy (defaults to "/")

      • OptionaluserContext: UserContextOptions

        Optional user context for OAuth providers (required if provider.RequiresOAuth is true)

      Returns Promise<StorageListResult>

      A promise that resolves to a StorageListResult containing: - objects: Array of file metadata (name, size, contentType, lastModified, etc.) - prefixes: Array of directory/folder path strings

      // List contents of the root directory
      const fileStorageProvider = await entityMgr.FindById('FileStorageProvider', 'aws-s3-main');
      const result = await listObjects(fileStorageProvider, '/', '/', userContext);

      // Display files
      for (const file of result.objects) {
      console.log(`File: ${file.name} (${file.size} bytes)`);
      }

      // Display folders
      for (const folder of result.prefixes) {
      console.log(`Folder: ${folder}`);
      }

      // List contents of a specific folder
      const docsResult = await listObjects(fileStorageProvider, 'documents/', '/', userContext);