Skip to content

Conversation

@farnabaz
Copy link
Collaborator

@farnabaz farnabaz commented May 27, 2024

resolves #101

This creates a slightly breaking change when delimiter is defined in request

CleanShot.2024-05-27.at.18.20.44.mp4

@farnabaz farnabaz requested a review from atinux May 27, 2024 16:00
@atinux
Copy link
Contributor

atinux commented May 28, 2024

Thanks for the PR!

I would like to give a consistent experience for what is returned from the list() method and returns:

interface BlobListResult {
  blobs: []
  hasMore: boolean
  cursor?: string
  folders?: string[]
}

Also, adding the option folded: true option instead to return the folders:

// Folded mode
const { blobs, folders } = await hubBlob().list({ folded: true })

// Expanded mode
const { blobs } = await hubBlob().list()

By returning hasMore and cursor, we also fix the pagination issue we have (to be tested):

We should be able to do:

const { list } = hubBlob()
let hasMore = true
let cursor
 
while (hasMore) {
  const res = await list({
    limit: 10,
    cursor,
  })
  hasMore = res.hasMore
  cursor = res.cursor
}

Copy link
Collaborator Author

farnabaz commented May 28, 2024

Also, adding the option folded: true option instead to return the folders:

Buckets accepts delimiter string to create these folds. I think kipping this delimiter makes more sense, and allows users to customise folding bahavior. WDYT @atinux ?

const { blobs, folders } = await hubBlob().list({ delimiter: '/' })

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 28, 2024

Deploying nuxthub-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8069b00
Status: ✅  Deploy successful!
Preview URL: https://4fdfbc26.nuxthub-module.pages.dev
Branch Preview URL: https://feat-blob-folders.nuxthub-module.pages.dev

View logs

Co-authored-by: Sébastien Chopin <seb@nuxt.com>
@atinux atinux merged commit d4719b0 into main May 29, 2024
@atinux atinux deleted the feat/blob-folders branch May 29, 2024 14:31
Aslemammad pushed a commit to Aslemammad/nuxt-core that referenced this pull request Jun 12, 2024
Co-authored-by: Sébastien Chopin <seb@nuxt.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display blobs in a folder like structure

2 participants