misaelnieto / vercel-storage

A wrapper around the vercel storage api
MIT License
23 stars 6 forks source link

How to prevent to add random suffix to filename during "PUT"/File upload operation? #6

Open benagastov opened 4 days ago

benagastov commented 4 days ago

How to upload file to Vercel storage without adding random suffix? I need to overwrite the same file for dynamic content, thank you

misaelnieto commented 3 days ago

Add —no-suffix. E.g.

$ vercel_blob put --no-suffix chart.png
benagastov commented 3 days ago

Pardon me, if I use in Python like this:

from vercel_storage import blob

my_file = '/path/to/file.zip'
with open(my_file, 'rb') as fp:
    resp = blob.put(
        pathname=my_file,
        body=fp.read()
    )

Could I write it like this: from vercel_storage import blob

my_file = '/path/to/file.zip'
with open(my_file, 'rb') as fp:
    resp = blob.put(
        no-suffix,
        pathname=my_file,
        body=fp.read()
    )

Thank you

misaelnieto commented 1 day ago

It should be:

from vercel_storage import blob

my_file = '/path/to/file.zip'
with open(my_file, 'rb') as fp:
    resp = blob.put(
        pathname=my_file,
        body=fp.read(),
        options={'no-suffix' = True}
    )