Save file(audio) inside Angular/Electron project - node.js

I have an Electron/Angular Desktop app and want to save some audios inside a folder in the project as a functionality to the app to avoid doing it manually.
Below is my folder structure:
I want to save the audios inside the uploads folder, it is inside the server folder where i have a Nodejs server. It is working for now in development but i do not know how to run the node server when i build the app.
OBS.: I will just use the app in desktop and want the server runs together with the app without me to initialize it every time.
Can i do that?
I try some research but all is related to web development and web server.

Related

Store file in a local drive folder using electron or node.js

I create one software in electron. I need to add image upload functionality into it. Uploaded images will store in a local drive(D:// Drive) folder and also on preview time I need to access the same folder so I have not idea it is possible in electron and if yes then how can I do this?
And for an extra thing in the backend, I use nodejs if you have an idea about that thing is possible using node js then also tell me so I can integrate with node js also. just I need to store that images to a particular folder which is in my local drive and I also access that image from my local drive for preview things.
For selecting file to upload trigger event (ex. upload-start) through ipc from render process.
In main process in handler for this event use dialog module and .showOpenDialog() method which will return a path to the file.
Then in main process you can use fs module to work with file: read it, copy, move, rename and write.
And check How do I handle local file uploads in electron?

How to setup file upload from NodeJS/VueJS to another server?

I've created a VueJS App for file uploading in which it will be my admin panel (For CMS) with NodeJS as back-end. Now I want to upload the files that was passed to the NodeJS and move it to another VueJS App which is going to be my primary website in order for me to access the files locally. How can I do it? Any suggestions or different approach will do.
You have many options on how to move the files to another site.
You could store them in a shared bucket or shared directory between your 2 backends or you could add another route to download that file.
You could configure a cronjob to scp or rsync those files to your target machine.
This is really more of a question of how to sync a directory to some place else.

storing csv files on a dedicated server

I'm having trouble storing csv files on a heroku server. I have a javascript application running express and a few other node packages and wondering what I should do in order to maintain those csv files. Heroku will always wipe new data and revert to the last deployed code (https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted), so any new files added while the app is running will be erased. Wondering if I should look for another dedicated service to deploy the project on or store the data in a database.

Save image file to IBM Bluemix Node.js application

I have a Node.js application on IBM Bluemix.
I need to let the user upload a image. In my localhost, the image is save into the folder, no problems...
But when I do the same in production, the file isn't save to the server corresponding folder...
Someone can help?
Assuming this is a Cloud Foundry app ... the file system is ephemeral, you need to save the images somewhere external to the app for them to be persisted through app restarts.
There is a sample app that shows how to do this using Cloudant - https://github.com/IBM-Bluemix/nodejs-cloudant
You will need to specify the directory using __dirname , but every time you redeploy your application you will lose the files. Stoping and Restarting should be ok.

Create desktop folder electron

I'm using node fs to create a directory and then watch it in my electron app. Users can then use that directory to upload documents. I use chokidar to watch the directory for documents. This all works locally; fs creates the directory inside my app folder. I can drag and drop files in, everything works.
This doesn't work, however, when I deploy the app to windows. I've searched the filesystem and cannot find where this folder was created.
What I'd like to do is create the folder on their Desktop. It would be even cooler if I could react to movements of the folder (e.g. the user moves it to Documents).
Is there a way to
Create the folder on their desktop (both osx and windows)
Listen for when the folder has been moved to another location.
Thanks!
Update
Found a way to find their desktop directory
const dir = Path.join(require('os').homedir(), 'Desktop/whatever');
Is there a way to do number 2?

Resources