Answer the question
In order to leave comments, you need to log in
How to create a directory of files in JS?
There is data on the computer (150Gb photos ~ 50,000 photos divided into catalogs)
Photos are added permanently permanently. Windows operating system.
I need remote access to this data for many users (action → view, in the future adding remotely)
I want to create a server on NodeJS and an application with a browser view in the form of a gallery with meta information on files (when created, edited).
What is the best way to organize this access? Are there ready-made solutions, modules?
Now I’m thinking of creating a script that would go through all the directories every day (because other users can add photos), form a directory tree and rewrite it to the database, or it’s easier to show the root of the directory to the user every time and when clicking on the upper directories, the server will step by step transfer the state of the next directory (whether it will be so expensive to work the computer)?
Answer the question
In order to leave comments, you need to log in
Now I'm thinking of creating a script that would go through all the directories every day
Running scripts across the entire file system is always expensive. But there are alternatives:
1. update when opening a folder, this is what all file managers do
2. in the absence of the Internet, you already have to think, for example: downloading a certain directory (as well as the entire disk) at the request of the user
3. combine the first two options, provided that in at one time only one user works with the disk: when the folder is opened for the first time, the information is loaded, when the folder is opened again, it is retrieved from the cache of the current session
4. if the accuracy of the data is not critical, you can make a cache without clearing with a session update, then in offline mode a queue of messages for working with files (adding, editing, deleting, moving) is formed, which are sent as soon as possible, in this case, you need to provide options conflict resolution
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question