Server-side file system browser - node.js

I am creating a node.js web interface for an internal project in the company I am working at. The web page should allow users to select a file that is in the server memory disk for processing. I want to do something like a file browser but for the server-side file system.
I tried implementing it with jqueryfiletree but was not successful since I can not seem to put it to work. Is there any cheap trick or an useful package to do this?
Thank you in advance.

Using node.js you can get all files names in folder, using the fuction fs.readdir(). After that you can read file by name fs.readfile() and send him on client by http.
I think this is simplest solution.

Related

Node Js files protection

How can I protect my Node JS files to achieve similar behavior to a PHP file case? I would like to defend it to make it unable to download or display the inner content if anyone knows the URL of the file on the server.
Unless your Node.js server serves its own application directory as static files (or if there's a separate web server that expose them), the source code is not accessible.
Unlike with PHP, the JavaScript source code doesn't need to be anywhere near the hierarchy served by a web server.

how to upload a file xlsx, update it and make it available to download in frontend

guys
A different question than the others that I used to do here.
My application is a website based on Nuxt/Vuejs (frontend framework), expresse/nodejs for a backend and mongoDB for database NoSQL;
I need to add a space where I can input a file xlsx format in the frontend, make some scripts and modification with the content inside it (with python if it possibly) and then make it available to download a new file xlsx with all the modifications made;
So, someone knows how it is the best way to build it? I need to send the file to the backend, right? Or do I need to send to database to?
I have also the option to add some a backend framework
(django/flask), but I do not know if with nodejs I can solve this problem well.
I am a bit new developping ;)
You can do it all with this xlsx library
You can do it entirely on client side.
Or upload the file to server, do whatever you want (with this library, with python, or anything else), and send back the file when you done.
No database is required.

Vue Frontend + NodeJS backend - local web app (browser)

I need to create an application which will be ran on the browser (local only, not hosted online). I will need to use a lightweight database which has a physical file (eg SQLite3, so I can have a .db file).
Also, just to mention:
I cant use IndexedDB alone to save the data because clearing browser data would clear the entire "database".
I also wouldn't be able to use electron since the bundle is too big. I need the browser for its portability
Also cant use PouchDB, since due to security constraints, online sync (CouchDB, etc) is not possible. Then it would be 100% stored in IndexedDB, which brings me back to my point on bullet 1
My question is - is there a way to create an offline web application build with VueJS frontend + NodeJS backend? I only need NodeJS because SQLite only works on the Node environment.
Deployment is preferably in .html only (is there any way that is possible, and access only using the file protocol file://)? Otherwise, I may consider using a local web server (localhost) - I'm not sure though if it is possible to serve an html file without any installations (node, python, etc), so I would still have to check all my options about this.
Any thoughts?
I am still new to this so please bear with me! There is very limited info online that talks about a 100% offline web application. Thanks a lot!

Cannot Write File in Electron App After Build

I know this is a repetitious question but i can't find any answer
I want to store my electron app data in a local json file
This works very good but after packaging and building it doesn't work
I tried to run app in administrator but that doesn't work again!
i don't know how to solve this problem
There is a way to store data in electron app No Matter How
thanks
Where are you saving this file? Unless you have admin access, you can't save to certain directories because that would expose a lot of potential security holes of written apps.
There was a package written that allows you to save data in a file for your app, making use of the path of app.getPath("userData"). This is the magic path you need to be using, app.getPath("userData"). If you aren't saving your data to this path, you will require admin access.
That package although makes use of outdated security practices, so if you want to still save your electron data to a file with better practices (ie. using IPC instead of the remote module), I'd recommend this template that I am an author of.

How do you get a server to upload and work for your game?

I've been searching all over the web and have attempted to upload my node.js based server up to a few various web hosters with no result. As far as I know most hosters don't support node.js to begin with, and I have a list of a few that do.
But my primary question is, how do you get your server working on this hoster in the first place? do you just upload it? does it sort of self run once uploaded? do I have to access that hosters cmd in order to get it running?
Sorry for what is probably a very newbish question, which I assume it is as I have yet to find a guide that covers this because it is apparently too basic. They always seem to skip this part:s
You'll just need to upload your files to a web host that supports javascript and offers command line access; for example, check out Amazon's free scalable offering. Once you have the files uploaded, just run them from the command line:
% node node.js

Resources