I want to upload a xml file in binary mode using Python 3 Basic Libraries.
Actually I need to upload it through a http post request.
I don't want to use any other external library for this.
Is it possible?
Thanks.
Upload an XML file to what? A server? If so, then yes, it is possible. Consider ftplib, a basic library (comes with vanilla python). Read the documentation there -- it supports binary mode uploads.
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.
When I download node.js from the internet through bash shell commands, am I merely downloading a "functions" folder that has many files in them, or am I downloading anything else besides that?
This question came from the shocking realization I got when I downloaded AngularJS framework and realized it was literally a one page document and nothing more.
Node.js contains a compiled executable that can load and run Javascript code.
This exposes quite a few built in functions that run compiled code within the executable, as well lots of other plain javascript in plain *.js files that make up the standard library.
But to run all that Node.js integrates the V8 javascript engine which is written in C++ and then compiled for your operating system.
When you download Angular, it is meant to run in a browser. That browser provides the execution environment. So all Anglular must provide is it's own code, which you can then leverage for your own projects. Javascript libraries really are just Javascript.
Think of Node.js more like your web browser. It's a program that can execute Javascript, as well as provides the basic functionality you need to write Javascript programs.
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.
So, I'm developing a node.js app that will show some markers in google maps according to the locations it finds in the database, which will then be converted and saved to a .txt file. Everything works great up until that point.
If i do a console.log() of the converted latitudes and longitudes it will show them perfectly.
However, in the .html file with the maps api i have to import the file that will return the coordinates.
Since this file is written in html with script tags to import the script, it interprets those scripts as javascript, and because of that, it stops working.
Firebug shows me that the file is found and shows me the content of it, but in the .js script file i have to do stuff like this to use node.js modules, that are necessary for my functions to work.
var fs = require('node-fs');
or like this to use functions in the file from other modules.
exports.someFunction = someFunction;
So, when the browser loads the map and tries to find the coordinates that i'm passing from the script that reads the .txt file where they're saved, it finds any of those two things and can't process them, because they're node.js, not plain javascript.
So my question is, how do i get javascript to recognize require() and exports when they're node.js commands?
If I understand you correctly and you're trying to use Node.js module system in browsers, that won't work. Browsers doesn't implement such features natively. Script files can only be included to the page with script tags or some kind of ajax system that fetches the files from the server. There are few such a libraries that provide such a functionalities.
RequireJS might be what you're looking for the client side though.
RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node. Using a modular script loader like RequireJS will improve the speed and quality of your code.
Also note that some of the Node.js features are not possible in the browsers. For example the direct file system access is not possible in the browsers, it would be a huge security risk.
Most javascript modules that provide both server and client side functionalities explicitly mentions it and provide separate script files for both sides.
Also if you only want to send coordinate data from the server to the client, then it might be good to use Ajax or WebSocket to send the data in a JSON format.
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