C
C
Crone13312022-04-19 21:19:03
JavaScript
Crone1331, 2022-04-19 21:19:03

How to get list of files in remote storage via js?

The bottom line is
I have some kind of remote image storage, for example www.site.images/
It stores images that I can access by type:
www.site.images/1.png
www.site.images/2 .png
www.site.images/photo/1.png
and so on...
Can I somehow get the whole hierarchy using js, what kind of pictures and folders are there?
I want to make an application for visualizing the repository, so I need to get the available directories from this repository and files for them, but I don’t know how to parse / get obviously unknown directories and files from there

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Ne7Le4Der, 2022-04-19
@Ne7Le4Der

If this is an external site, to the backend of which you do not have access, then there are several options:
1) Look, in DevTools, there may be some requests with which you can get the entire pool of images (most likely not).
2) If the pictures have some logically chosen names (for example, as you wrote, 1-2-3...), then you can sort through the url's until we hit an empty one. Then do the same with /photos/1-2-3...
If you have access, then there are also several options:
1) Make a small server application that will give the folder structure
2) Save pictures under the name in the same increment ( 1-2-3...), and then item 2 from the top list. But better, of course, is a small server application.

I
imko, 2022-04-19
@imko

https://caniuse.com/native-filesystem-api

A
Alexander, 2022-04-21
@Aleksandr-JS-Developer

Write a script in some php that goes through all the directories and returns the structure. You visualize it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question