You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@firebase/storage

Package Overview
Dependencies
Maintainers
4
Versions
3547
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firebase/storage

This is the Cloud Storage component of the Firebase JS SDK.

0.13.14
Source
npmnpm
Version published
Weekly downloads
3M
-0.62%
Maintainers
4
Weekly downloads
 
Created

What is @firebase/storage?

@firebase/storage is a Firebase service that provides a powerful, simple, and cost-effective object storage solution for web and mobile applications. It allows developers to upload, download, and manage files such as images, videos, and other user-generated content directly from their applications.

What are @firebase/storage's main functionalities?

Upload Files

This feature allows you to upload files to Firebase Storage. The code sample demonstrates how to upload a simple text file to a specified storage reference.

const { getStorage, ref, uploadBytes } = require('@firebase/storage');
const storage = getStorage();
const storageRef = ref(storage, 'some-child');
const file = new Blob(['Hello, world!'], { type: 'text/plain' });
uploadBytes(storageRef, file).then((snapshot) => {
  console.log('Uploaded a blob or file!');
});

Download Files

This feature allows you to download files from Firebase Storage. The code sample demonstrates how to get the download URL for a file stored in Firebase Storage.

const { getStorage, ref, getDownloadURL } = require('@firebase/storage');
const storage = getStorage();
const storageRef = ref(storage, 'some-child');
getDownloadURL(storageRef).then((url) => {
  console.log('File available at', url);
});

Delete Files

This feature allows you to delete files from Firebase Storage. The code sample demonstrates how to delete a file from a specified storage reference.

const { getStorage, ref, deleteObject } = require('@firebase/storage');
const storage = getStorage();
const storageRef = ref(storage, 'some-child');
deleteObject(storageRef).then(() => {
  console.log('File deleted successfully');
}).catch((error) => {
  console.error('Error deleting file:', error);
});

List Files

This feature allows you to list all files within a specified directory in Firebase Storage. The code sample demonstrates how to list all files under a specific storage reference.

const { getStorage, ref, listAll } = require('@firebase/storage');
const storage = getStorage();
const listRef = ref(storage, 'some-child');
listAll(listRef).then((res) => {
  res.items.forEach((itemRef) => {
    console.log('Item:', itemRef.name);
  });
}).catch((error) => {
  console.error('Error listing files:', error);
});

Other packages similar to @firebase/storage

FAQs

Package last updated on 30 Jun 2025

Did you know?

Socket

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.

Install

Related posts