How to change directory (outside directory i.e. desktop) of file system in node.js - node.js

Hello I'm having difficulties in creating files in nodejs, when i try to create a file it only creates within the folder of my program. For example, I created test.txt then it will create on the program folder. what i want is to create a file outside the program folder. For example, I wanted to create test.text on desktop. is it possible?
I am using this:
app.use(express.static(path.join(__dirname, 'assets')));
Thanks

I believe if the purpose of this is to have backup of files, then you should rather run a basic script which will dump your files from your program location. You could always schedule it based on your choice of frequency.
It would be a much better approach instead of going out of your program folder just to create files. Not recommended!

Related

How to hide PHP code on the server from other person under root?

Good day!
There are PHP scripts, classes, configs. All this stuff is interconnected, I need to give a person access to the server so that he works (started under the root) with these scripts, while changing only the config files, and in order to not be able to view the source code.
I've researched various free obsfukators which converting code into something:
<?php include(base64_decode('Li4vY29uZmlnLnBocA=='));include(base64_decode('cHJpdmF0ZS92ZW5kb3IvYXV0b2xvYWQucGhw'));$krc_5bf7f45b=[];foreach($bhi_6f9322e1as $xol_e8b7be43){$xol_e8b7be43=explode(base64_decode('Og=='),$xol_e8b7be43);try{$uic_c59361f8=new \xee_d9cb1642\cko_659fc60();$uic_c59361f8->ldc_aa08cb10($xol_e8b7be43[0],$xol_e8b7be43[1]);$krc_5bf7f45b[]=$uic_c59361f8;}catch(Exception $wky_efda7a5a)
What if the files of configs have variable names and it turns out that when obfuscating the main working code, the variables have different names? Not to force the user to run through the obsfukation corrected config every time? So far, this option seems the only one.
Is it possible inside the server under Ubuntu to somehow limit the ability to copy or view or download certain files or make some other methods of protection-hiding, but at the same time with the ability to run this code. It was thought to hide the code somewhere in the depths of the file system folders, calling them random names, and run them somehow through the symlinks by the file name or something like that. Is it possible to?
Option not to provide root access to the server, but to launch via the browser, to give access only to FTP to upload the config to a separate folder. But there are a number of points - all scripts run up to a week, and must be executed as root. How to solve it?

How to monitor a directory for file changes without using inotifywait?

I require a VM for developing and my host is where my IDE is. I have discovered that inotifywait does not work with shared folders, as I am sharing a local folder with my Linux guest using Virtual Box.
Basically, I have a simple bash script which needs to watch a directory and wait for any file changes. Inotifywait would be the best option but I cannot get it to work with my shared folder.
I was wondering if there is another option for my problem?
Depending on the sizes of the files and the nature of the changes you could:
Create a checksum (md5, CRC, SHA256) of the files and watch for changes
check the size of the files and watch for changes

Database folder on development mode

On arangodb's documentation it is suggested to use a different folder to databases during development phase (/tmp/fancy_db). I try to use this but I get errors saying that no database exists... How can I create databases on this temporary folder?
Thank you
arangod will not create any folder for you, you have to give it an existing folder on your system.
/tmp/fancy_db
is just a suggestion you can use any folder at any location on your machine.
However to create a folder in /tmp on a unix system open a terminal and enter:
bash> mkdir /tmp/fancy_db
On a windows system (as far as i know) \tmp is not available, you can use
C:\tmp\fancy_db
instead (create it with Explorer)

Issue with App.Config in the Startup Folder

I am writing a console app in c#.net. I have a batch file that currently copies the exe and exe.config to the startup folder on local machine from the network. It is set up that way so the user only has to run the batch file and then everytime the computer is started the exe will run.
Problem I am running into is that it also opens (or tries to open) the exe.config file as well. I am looking for the best workaround for this without it being overly complicated. Thought about putting the config file in a diferent location and then hardcoding the new location into the configuration manager but one of the concepts with the config file is to keep all hardcoded paths out of the code for easier updates if locations change. Also thought about putting a shortcut to the exe in the startup folder which would work but I want it to be transparant to the user. In other words all I want the user to do is run the .bat file once and forget about it.
Any help or ideas would be greatly appreciated as I am very new to .bat files
I like your idea of a shortcut, or for that matter a batch file pointing to the executable, with both the executable and config file located outside the startup folder.

Linux Folder/Package Management

I'm looking for a way to store all my applications files within a single folder. However, when someone clicks on the folder I want the application inside the folder to open up as opposed to open the folder itself. I want to keep all dependancies and files inside this folder at all times.
I'm doing this because I'm going to be deploying a couple applications on a common framework and want to ensure that they are together and independent of the distribution have all requirements.
Folders are directories, and directories are distinct from files. There's no way to redirect a directory to an executable file. However, you can make a hidden directory (begin name with ".") and use an executable file to provide access to that directory. The directory will then not appear in window manager folders, just the application. However, window managers will not misrepresent the executable file as a directory.

Resources