https://discord.cloudflare.com logo
Join Discord
Powered by
# r2
  • e

    Erisa | Support Engineer

    05/01/2022, 4:28 PM
    From what i can tell there isn't much of a concept of directories, but a prefix would work just as well, something like
    r2.list('folder/')
  • j

    James

    05/01/2022, 4:28 PM
    You can call
    R2.list({prefix: 'abc'})
    I believe
  • e

    Erisa | Support Engineer

    05/01/2022, 4:28 PM
    oo
  • e

    Erisa | Support Engineer

    05/01/2022, 4:28 PM
    Didn't know that
  • e

    Erisa | Support Engineer

    05/01/2022, 4:29 PM
    Any idea what the limit of files it can list is?
  • j

    James

    05/01/2022, 4:29 PM
    the types are probably the best docs for now: https://github.com/cloudflare/workers-types/blob/c2c7c2e0d20b7ad6c269a67cc529eb6fd59d9885/index.d.ts#L999
  • j

    James

    05/01/2022, 4:29 PM
    max (and default) is 1000 I believe
  • e

    Erisa | Support Engineer

    05/01/2022, 4:29 PM
    Fair enough, thats okay
  • j

    James

    05/01/2022, 4:29 PM
    it supports a cursor and iterating through if you need to read more, like KV
  • e

    Erisa | Support Engineer

    05/01/2022, 4:30 PM
    Makes me wonder how many you could grab until you start hitting hard limits on R2 calls
  • v

    Vitali

    05/01/2022, 4:30 PM
    If you want "folder"-like iteration, setting
    delimiter
    to
    /
    is what will give you that (it's how AWS and the others work too)
  • v

    Vitali

    05/01/2022, 4:30 PM
    I'm curious what the download limit you hit is. I think the current limit is going to be ~3GB but would love to know what it is in reality
  • e

    Erisa | Support Engineer

    05/01/2022, 4:31 PM
    I uploaded a 5.5 GB file, going to set it to download from a gigabit server and see what happens
  • e

    Erisa | Support Engineer

    05/01/2022, 4:32 PM
    download speed seems to be capping around 25-30 MB/s which is odd but it could also be unrelated to R2
  • e

    Erisa | Support Engineer

    05/01/2022, 4:33 PM
    So something like
    R2.list({prefix: 'foldername', delimiter: '/'})
    to list everything in the
    foldername/
    directory? Or would prefix need / on the end as well?
  • e

    Erisa | Support Engineer

    05/01/2022, 4:34 PM
    It seemed to give up around 4 GB
    Copy code
    2022-05-01 16:33:45 (28.5 MB/s) - Connection closed at byte 4318273536. Retrying.
  • v

    Vitali

    05/01/2022, 4:34 PM
    Sounds reasonable
  • e

    Erisa | Support Engineer

    05/01/2022, 4:36 PM
    the next retry ended at the same byte
  • e

    Erisa | Support Engineer

    05/01/2022, 4:36 PM
    so i suppose 4318273536 bytes is the limit
  • v

    Vitali

    05/01/2022, 4:37 PM
    28.5 MB/s is slow
  • v

    Vitali

    05/01/2022, 4:38 PM
    Wonder which part is bottlenecking there
  • e

    Erisa | Support Engineer

    05/01/2022, 4:38 PM
    I'm gonna try from another cloud provider
  • v

    Vitali

    05/01/2022, 4:38 PM
    which provider were you usiung?
  • e

    Erisa | Support Engineer

    05/01/2022, 4:38 PM
    OVH France
  • e

    Erisa | Support Engineer

    05/01/2022, 4:38 PM
    server has gigabit down
  • v

    Vitali

    05/01/2022, 4:39 PM
    Gotcha. What if you try somewhere in the US?
  • e

    Erisa | Support Engineer

    05/01/2022, 4:39 PM
    i can do Hetzner's Ashburn region
  • e

    Erisa | Support Engineer

    05/01/2022, 4:40 PM
    Copy code
    2022-05-01 18:40:45 (44.7 MB/s) - Read error at byte 2984001536/5883697152 (The TLS connection was non-properly terminated.). Retrying.
  • e

    Erisa | Support Engineer

    05/01/2022, 4:41 PM
    the next attempt seems a lot faster, its up in the 60s
  • e

    Erisa | Support Engineer

    05/01/2022, 4:42 PM
    then it started varying a lot, average was 56.1
    Copy code
    2022-05-01 18:41:59 (56.1 MB/s) - Read error at byte 4211154944/5883697152 (The TLS connection was non-properly terminated.). Retrying.
1...99100101...1050Latest