Cloud Services | google rpc | | Search

google storage api

create a bucket

This code defines functions for managing Google Cloud Storage buckets, including listing existing buckets, creating new ones, and setting public access.

test create bucket

This code snippet is a unit test that verifies the functionality of a function designed to create a Google Cloud Storage bucket. It imports the function, sets up test parameters, calls the function, and asserts that a bucket was successfully created.

test stream to output

This code defines a utility function called streamToOutput that downloads a file from a URL or processes a stream and saves it to a local file. It handles directory creation and utilizes imported functions for file fetching and stream processing.

fetch file or stream

This code provides a utility function called fetchOrStream that downloads a file from a URL or processes an existing stream, writing its content to a specified write stream. It handles both scenarios using a single function and returns a Promise for asynchronous execution.

upload files to google cloud

This code provides a utility function called streamToGoogle that uploads files or streams to a specified Google Cloud Storage bucket, handling bucket creation and metadata.

copy a file in storage bucket

This code provides a function copyFileBucket that copies a file within a Google Cloud Storage bucket, utilizing Google Cloud APIs for authentication and file manipulation.

test upload files to google storage

This code tests the streamToGoogle function, which uploads a file to Google Cloud Storage, by asserting that a valid URL is returned after the upload.