Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
firebase-storage
Advanced tools
Easily operate Google cloud storage with a private key.
Works with Edge runtime
.
import { getStorage } from "firebase-storage";
const privateKey =
"-----BEGIN PRIVATE KEY-----\nXXXXXXXXXXXXXXXX-----END PRIVATE KEY-----\n";
const clientEmail =
"firebase-adminsdk-XXXXX0XXXXX@XXXXXXX.iam.gserviceaccount.com";
const bucket = "XXXXXXXX.appspot.com"; // Can also be specified in each function
const parallels = 5; //default 1000
async function main() {
const storage = getStorage({ privateKey, clientEmail, bucket, parallels });
const file = new Blob(["Test value"], {
type: "text/plain",
});
await storage
.upload({
published: true,
name: "test",
file,
metadata: {
cacheControl: "public, max-age=31536000, immutable",
},
})
.then(console.log);
await storage.list({ bucket }).then((objects) => objects.map(console.log));
await storage.info({ name: "test" }).then(console.log);
await storage
.download({
name: "test",
})
.then((v) => {
console.log(new TextDecoder().decode(v));
});
await storage.del({ name: "test" }).then(console.log);
await storage.infoBucket({ bucket }).then(console.log);
await storage.updateBucket({ bucket, body: {} }).then(console.log);
}
main().catch(console.error);
FAQs
Easily operate Google cloud storage with a private key
We found that firebase-storage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.