A
A
Anthony2017-10-05 14:23:54
JavaScript
Anthony, 2017-10-05 14:23:54

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

2 answer(s)
D
Dmitry Kuznetsov, 2017-10-05
@dima9595

Now I'm thinking of creating a script that would go through all the directories every day

Of course it will be difficult. Why make it so that the script would go through all the directories? Wouldn't it be easier to make the user entering the folder - only then would the script give the files?
Unfortunately, I can’t give information on another issue, because I don’t know myself ... I was also interested in this.

V
Vitaly, 2017-10-05
@vitali1995

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 question

Ask a Question

731 491 924 answers to any question