You say that you don't want to use Google Cloud, but I've got some bad news for you, that's all Firebase storage is - just a wrapper around Google Cloud buckets. If you use Firebase storage, you'll be using Google Cloud storage.
Code wise, it looks like you are confusing the different Firebase libraries out there. You're using the Javascript SDK for the FRONT END... but you have this question tagged as node.js - if you're trying to do things from a server, you need to be using the Javascript SDK (called firebase-admin) for Node.js
You said you've already found the other answers for explaining how to interact with Google Cloud, and I'm not going to write out an entire step-by-step guide, but just to point anyone coming across this in the future towards the right direction...
This is the relevant page for Firebase storage for Node.js: https://firebase.google.com/docs/storage/admin/start
That's the official page for server-side uploading to Firebase Storage (which is, again, really Google Cloud). It links to the official Google Cloud docs for explaining how to upload files.
... So putting those two things together, from the Firebase docs, you would get your bucket reference:
var bucket = admin.storage().bucket("my-custom-bucket");
... and then reference this code from the Google Cloud docs for the example of uploading with your bucket reference:
// Imports the Google Cloud client library
const {Storage} = require('@google-cloud/storage');
// Creates a client
const storage = new Storage();
/**
* TODO(developer): Uncomment the following lines before running the sample.
*/
// const bucketName = 'Name of a bucket, e.g. my-bucket';
// const filename = 'Local file to upload, e.g. ./local/path/to/file.txt';
// Uploads a local file to the bucket
await storage.bucket(bucketName).upload(filename, {
// Support for HTTP requests made with `Accept-Encoding: gzip`
gzip: true,
metadata: {
// Enable long-lived HTTP caching headers
// Use only if the contents of the file will never change
// (If the contents will change, use cacheControl: 'no-cache')
cacheControl: 'public, max-age=31536000',
},
});
console.log(`${filename} uploaded to ${bucketName}.`);