SociallyDev / Spaces-API

An API wrapper for DigitalOcean's Spaces object storage designed for easy use.
MIT License
218 stars 103 forks source link

List directories only functionality #66

Closed schmidtl4 closed 10 months ago

schmidtl4 commented 3 years ago

What's the best way to get a listing only of folders. I know that folders aren't really folders but prefixes to the file name. That said, I'd like to be able to see just the folder names for a particular space. Any way to do that?

SociallyDev commented 3 years ago

Hey, There are a couple ways that I can think of to sort of achieve folder-like functionality:

schmidtl4 commented 3 years ago

OK thanks - not exactly what I'd hoped for but thanks for the suggestions. Les

Les Schmidt Simplicity, Clarity, Focus Founder & Executive Director BRIIA https://briia.io/ WE ACCELERATE INNOVATION

Why the Tri-Valley? See this http://www.bayareaeconomy.org/report/tri-valley-rising-2018/! LinkedIn BRIIA https://www.linkedin.com/company/briia.io/ | Twitter BRIIA https://twitter.com/briia_io | Medium @.***_IO> | LinkedIn Les https://www.linkedin.com/in/lesschmidt | +1 408.242.4986

On Wed, Aug 4, 2021 at 10:56 AM Devang Srivastava @.***> wrote:

Hey, There are a couple ways that I can think of to sort of achieve folder-like functionality:

-

You could store folders in a separate database at the time of upload & refer to that database when you want folders.

You can iterate over all objects, explode() the ones containing a / using the char /, and then join n - 1 parts back to form a folder & sub-folder structure.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SociallyDev/Spaces-API/issues/66#issuecomment-892856310, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK2LSW6GMCNHIIEF2AUOADT3F5MFANCNFSM5A5OUTPQ .

MacroMan commented 3 years ago

This could be a nice enhancement actually.

I'm reopening this a feature request

divyeshJoshiG commented 3 years ago

Please tell how to create a new folder in space, please tell api with example. Thanks

MacroMan commented 3 years ago

Please tell how to create a new folder in space, please tell api with example. Thanks

You can't do that directly. Spaces doesn't support having an empty folder/directory. You can upload text/file with the path, which will "create" the directory on demand: $space->uploadText('Lorem ipsum', 'folder-name/remote-filename.txt'); If all files are removed, the folder/directory will be removed too.

MacroMan commented 10 months ago

This library is now deprecated and this feature will not be implemented. We recommend using the official SDK or the Laravel package