JavaScript API Drive Uploader - Upload file manually using JS - javascript

I am using drive uploader component (https://driveuploader.com/) in my application to upload files on GoogleDrive. It is workign fine as long as the user selects file using the component. Now the new requirement needs me to upload the file manually using JavaScript. I will be given bytes array and then I need to convert that bytes array to file and then upload it to google drive using driveuploader and the further process goes on as is, but I am not able to come up with the idea how to do it. Any pointer in this regard are appreciated.
Thanks.

Related

How to Auto Upload a json file to my github Website

There is a program in my company that generates a JSON file. I created a website (that will be live on github pages) using java script and html that displays the information from this JSON. Now I want others in my company to generate individual JSON files and be able to upload them to this website by clicking a single button. I'm thinking the button they click would generate the JSON (let's say it saves automatically as c:data.json), programmatically open the github pages website and then programmatically upload c:data.json. I do not want the json file to be stored on the website, just uploaded for one time use.
I have done a couple google searches and can only seem to find stuff on how to upload a json file in your code which I am already doing locally. I need a local file to programmatically upload, in order to be used in a github pages website. I'm new to web dev and any help is appreciated :)
OS: Windows 10
developed using: node.js, javascript, html, json, github pages.

How to convert DOCX to ODT format using javascript?

I am working on a in-website document editor(word and excel document). So far I am able to edit ODT files using WEBODF. Is there any way to convert DOCX file to ODT using javascript so that i can use the file in the editor? any alternatives for editing word and excel documents inside a website? I have tried saving the file in OneDrive and then using the share link to open editing on sharepoint but this editor cannot be inserted inside an website and can only be done in a new tab? i need the editor inside the website as i need to implement azure versioning of the documents
WebODF is an awesome tool to be used as an online editor. Assuming you have no restrictions implementing a separate backend server, you can use libreoffice, which gives you a command line utility to exactly perform that job. You can convert docx file to odt file using the following command -
soffice --headless --convert-to odt <input file>.docx
The approach would be to create an API
Which would take docx file as input
Store that file temporarily somewhere and run the above command
Serve the converted odt file and delete the temporary files.
If you want to store those files in the server, then you can maintain a database to achieve that as well.
To take care of restricted cross origin policy, you can implement AJAX calls in the front-end to perform file uploading and viewing operations using Javascript blobs.

How to download pdf file using vuejs and bootstrap-vue

I'm trying to upload a pdf file to my browser, but I want to be able to download this file afterwards. I am having problems on the second task - downloading it.
I'm uploading as follow:
<b-form-file v-model="form.file" :state="Boolean(form.file)" placeholder="Choose a file..."></b-form-file>
How can I download form.file content after upload is done?
Edit:
I found this API, which handles file downloads nicely.
You need to save the file somewhere on your server or on a storage service (ie Amazon S3) and then redirect the user to a link where the file itself is served.
The specific implementation is based on your backend implementation and your architectural choices.

Is there any way to display pdf files in browser such that the viewer can only read the file and can't save/download/print the file in any form

I have to integrate pdf files in my PHP web application such that the viewer of the file can not save/download/print the pdf file.
I am finding a way of doing this in any way like using javascript, jquery or straight in PHP or any other way if any.
I think you'd need a custom PDF viewer in your app, like what Google Drive does with images and documents.
I'm not aware of any functionality that allows an app to tell Chrome/Firefox or the registered PDF handler to limit user interaction like you mention.

Can we create a temp text file with JavaScript to upload to a cloud storage?

I'm working an HTML5+JavaScript application (using KineticJS 4.4.3) that requires a save functionality
The current demo has save feature which saves the Stage to localStorage using toJSON() and is working fine.
Now I'd like to save this JSON string in a file on a cloud storage like Dropbox, Google Drive, etc. Unlike saving canvas to an image with toDataURL(), I'm unaware of any method in JavaScript that can create a temporary text file that I can provide a URL and upload. Any ideas?
One alternative I have in mind is using a server side function i.e. php to create a file and so on... but that will require periodic cleaning of the folder used to generate this text file (I'm using a shared hosting so not thinking of using the temp directory).

Categories

Resources