I need some input, as I am a newbie when it comes to MERN. I would like to upload a file, such as a Word Docx file or text file, to my backend and execute an OS command on the file when received.
I see that there is a lot of express middleware that can be used for this task, such as Multer or Express-fileupload. Most of these libraries deal specifically with images though in examples.
I simply want to know what middleware the community would recommend for this specific case?
I'm on a MERN stack as well, and I'm using Multer. It took some getting used to as it was the first file upload library I've used, but overall I like it. I'd recommend. Express-fileupload seems pretty good as well. I think you'll be in good hands with either.
Related
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.
Please explain, how can I add some text to the image with nodejs. I googled all day but didn't find a solution other than using libraries. Why is this done in php with one line of code, but with nodejs you need bunch of third-party code to be imported to your server? Thank you.
I 'am a newbie programmer.
Today I want to install and configuration formidable for my project.
https://www.npmjs.com/package/formidable
I have question:
where I find information about how to save files to dir? I see on npmjs example code with express.js, but in this code not include information about save, documentation also not included information about save files to dir.
How I should read that documentation like this? I will be grateful for any comments, probably at the moment I don't think like programmer.
The documentation says that files will be saved ...
You should try the examples before making random guesses.
I've just started my IT degree and I'm a beginner to the use of APIs (and forums like this) so I am truly sorry if my question is to vaguely explained or if it is just plain stupid :), on top of that I'm not a native English speaker :P. Okay, so I'm trying to use Google trends' api which I installed in my server with putty by using sudo npm install google-trends-api. (it can be found here https://www.npmjs.com/package/google-trends-api#installation) As I undestand it, this is a server side api so the scripts that I write with the methods provided for this api will not run on an explorer as normal js files do. There is an example that makes use of the API that I found on the page which is as follows
var googleTrends = requite('google-trends-api');
googleTrends.hotTrends('US')
.then(function(results){
console.log(results);
})
.catch(function(err){
console.log(err);
});
this outputs a list of 20 items on the console when I use it on node.
I would like to know if there is a way to assign those results to a variable and then use that variable in a normal javascript script inside a html file. I do not know anything about node.js and the like, and I would like to actually do some research instead of asking here but I was going to use a different approach to acquire such information but now I've had to change my plans and do not have enough time and given I consider this is a fairly easy problem to resolve (maybe?) I would really appreciate it if someone could walk me through the basics of each step. THanks :) and have a nice day.
Your question is quite broad. Node.js is Chrome's V8 engine bundled with some libraries to do I/O and networking. This enables us to JavaScript outside of the browser and to create backend services or servers in general (in your case). I hope that you are aware of this difference :)
The first thing that you have to do, is to have a look at express.js and to create a simple server. It will not be more than 20 lines of code. Then you have to enrich this with more stuff like a template engine (handlebars.js, jade etc). You have to enable the server to serve static files that will be finally your js, css and image files. Creating this simple server you will be able to serve simple html page in the first place. On top of that you should have the client side javascript that you have to write and now you can use the module above. Unfortunately, you are not able to use this module directly on a javascript file that you will write. To be able to use this module you have to transcompile this thing into javascript that browser understand*. Remember that browser does not understand the require statement and some old browsers possibly will have issues with the promises that this module is using. These are the things that should be compiled. You have to use a tool like browserify for this and the compiled file that this will extract it must be included in the scripts of your html page.
Maybe there are quite a lot of concepts that you are not aware of or you don't understand them but spend a bit of time to understand them.
P.S.: I' ve replied under the assumption that google-trends-api module does not use things that are specific to node.js like the file-system for example.
Im trying to make a plugin for require.js that allows me to call an external api, convert the json response and save it to a file.
Problems:
Im not sure if I am writing the plugin correctly
I cant seem to use node filesystem - though i am using r.js
I am hoping to do this on build, so that the file is ready before concat method happens (putting all files into one)
Is this even possible? Should I use a grunt task instead?
Any pointers or examples or tutorials or anything would be really useful.
In the end I used, https://npmjs.org/package/grunt-curl.
Was alot easier, and just modified the file a bit to wrap the response in define();
It allows the files to be downloaded on build and required later in the app