Reputation: 511
I want to write a CLI app in nodejs that authenticates and uploads a file to firebase, I installed the firebase
npm package but it is not well suited for NodeJS (client-side) use.
How can I authenticate and upload a file to firebase storage?
Upvotes: 0
Views: 1466
Reputation: 599591
There are two Node.js modules for Firebase, one for server-side Node.js code, and another one for client-side Node.js code (like on IoT devices).
If you're running the code on a server, you'll want to use the Firebase Admin SDK to access Cloud Storage. Note that this part of the Admin SDK is a fairly thin wrapper around the regular Node.js SDK for Cloud Storage, so I also recommend keeping the documentation for that package handy.
If you're running the code on a client, unfortunately the Node.js module does not have built-in support for uploading files to Storage. You'll have to look for another way, such as creating a custom API that your code calls and that uses a supported SDK for uploading the file to Storage.
Upvotes: 1