I am using React and JS to build a web app that relies on the REST API of a private web service. Using the API, I can obtain a url for a CSV file that contains data from a server process. The url can be used to download the CSV results from AWS to the user's desktop. The URL is of the form...
https://[identifier1].s3.amazonaws.com/[path and filename.csv]
?X-Amz-Algorithm=[identifier2]
&X-Amz-Date=20210602T001523Z
&X-Amz-SignedHeaders=host
&X-Amz-Expires=3599
&X-Amz-Credential=[identifier3]
%2Fus-east-1%2Fs3%2Faws4_request
&X-Amz-Signature=[identifier4]
(I inserted line feeds above for readability)
My problem is, I don't want the file saved to my local device, I want to parse it directly and read it into a js structure. For example, I would like to display the data directly in a table.
I could download the file and then have the user upload the saved file into the app, but that is not a great workflow. Is there a straightforward way to use the data directly without saving it as a local file?
Related
I have a simple project in which users fill a survey on a page, and I then have a js function that stores all of the data from the survey in a dictionary. I would now like to append this dictionary to a json file, and then upload this file to a server so that I can retrieve the data for further use on the website
I have heard that I should be using express with node but I'm new to web dev and I have no idea how
I am trying to create an "upload to OneDrive" button on my website, knowing that I would just like this to open a user authentication window (so that the user can upload the file created on my website directly on its own Onedrive cloud.
I have already done the same thing with google drive but so simply that I do not understand why I can not find a solution for my problem with "OneDrive" (and dropbox also for that matter ..)
my language is : nodeJs/python/Js
Create a database to store the files. Try using mondodb (a node package) to create a database to store uploaded files.
I'm using Node, along with express, Jade and a MongoDB. So far I'm able to query the database and display the data in a webpage.
In the database I am storing PDFs and I would like to be able to download these from the webpage. I can currently get the pdf data in the form of a string (of random character) and display them on a webpage but I'd like to have a button where the user can download it as a pdf.
To insert the pdf into the db I the below python code to open it and pyMongo to insert it.
file = Binary(open(filePath, "rb").read(), 0)
Thanks in advance.
This has little to do with the technologies you mention, but how you handle data on the client. Essentially you will need to utilise frontend JavaScript, HTML and how the browsers handle those in conjunction with data. A pointer would be here https://stackoverflow.com/a/39515978/3580261
So I am trying to figure out how to download an array of images to a users computer. I have been storing everything through calling my server as I feel more secure using firebase on the server. So on click of a button on the client I can get a return of an array of the images in my firebase storage bucket.
Button click -> call server -> get a return of the array of urls from firebase
Now is there a way to download these to the users computer? Prompt them to choose a file path or download them directly?
I know I can do a single download auto by this:
var a = $("<a>").attr("href", url).attr("download", "img.png").appendTo("body");
a[0].click();
a.remove();
I have tested a single url download that auto downloads on the button click, but I dont feel like I should have to loop through the array one at a time to download all nor do I know if this would work. I would assume it would since a single url works.
Is there a better way?
There is no way to download multiple files in one request from Firebase Storage. If you want to allow downloading of multiple files, you'll have to store them in a single (say zip) file and use the approach you already do today for downloading that file.
Alternatively you can use the Google Cloud Storage API to download a bunch of files. See this answer for more on that, but be aware the the Google Cloud Storage API is meant for use on an app server and not directly in your web page.
we are using google picker to fetch the file in our application. Previously it was one time thing, but we noticed that because we don't allow data manipulation on our app, user need to do the changes on the drive and again do the upload/fetch process. We want to simplify the workflow and allow user to do one click refresh/resync of the file (spreadsheet). In order to do that I am thinking to save the file_id on my app, though I'll still need to get oAuthToken to build the service and fetch the file. Is that right approach or please suggest if any other mechanism I can follow.
The current google-picker workflow is using js on the client side which provides oAuthToken, fileId, Name of the file. on the server side I use python to build the service and fetch the actual file.
In my opinion, your process i.e, saving the file ID and access/refresh tokens and fetch the file when you need is the correct way to go.
I have built an application where we manage our files using google drive. In short my process was:
User consent and Auth.
Use picker to upload files and upon successful operation save necessary file data.
Fetch the file (with access token or use refresh token to get new access token) whenever we need to view it to user
I hope this helps.
Cheers