Sign in
Log inSign up

(JS + Drive API) Can I use a URI as a file location

mark barton's photo
mark barton
·Feb 25, 2019

I'm trying to create a simple upload feature to my web app using the Google Drive API. The current version of the app lets you download a project file (.json) to your local drive, but I want to edit this to add a feature that allows you to save it directly to the Drive API.

I have created a URI of the file before downloading it using:

var text = //JSON TEXT\\

("data:text/plain;charset=utf-8," + encodeURIComponent(text))

Because the Google Drive API requires a filepath argument in order to complete the request, is it possible to use this URI as a filepath? Or do I need to do somthing else like save to web server temporarily or save to local storage?

Appreciate any help.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct