Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Google Cloud Platform logo

Google Cloud Storage Node.js Samples

Cloud Storage allows world-wide storage and retrieval of any amount of data at any time.

Table of Contents

Setup

  1. Read Prerequisites and How to run a sample first.

  2. Install dependencies:

     npm install
    

Samples

Buckets

View the documentation or the source code.

Usage: node buckets --help

Usage: node buckets COMMAND [ARGS...]

Commands:

  create BUCKET_NAME
  list
  delete BUCKET_NAME

Examples:

  node buckets create my-bucket
  node buckets list
  node buckets delete my-bucket

Files

View the documentation or the source code.

Usage: node files --help

Usage: node files COMMAND [ARGS...]

Commands:

  list BUCKET_NAME
  listByPrefix BUCKET_NAME PREFIX [DELIMITER]
  upload BUCKET_NAME FILE_NAME
  download BUCKET_NAME SRC_FILE_NAME DEST_FILE_NAME
  delete BUCKET_NAME FILE_NAME
  getMetadata BUCKET_NAME FILE_NAME
  makePublic BUCKET_NAME FILE_NAME
  move BUCKET_NAME SRC_FILE_NAME DEST_FILE_NAME
  copy BUCKET_NAME SRC_FILE_NAME DEST_BUCKET_NAME DEST_FILE_NAME

Examples:

  list my-bucket
  listByPrefix my-bucket /some-folder
  listByPrefix my-bucket /some-folder -
  upload my-bucket ./file.txt
  download my-bucket file.txt ./file.txt
  delete my-bucket file.txt
  getMetadata my-bucket file.txt
  makePublic my-bucket file.txt
  move my-bucket file.txt file2.txt
  copy my-bucket file.txt my-other-bucket file.txt

Encryption

View the documentation or the source code.

Usage: node encryption --help

Usage: node encryption COMMAND [ARGS...]

Commands:

  generate-encryption-key
  upload BUCKET_NAME SRC_FILE_NAME DEST_FILE_NAME KEY
  download BUCKET_NAME SRC_FILE_NAME DEST_FILE_NAME KEY
  rotate BUCKET_NAME FILE_NAME OLD_KEY NEW_KEY

Examples:

  node encryption generate-encryption-key
  node encryption upload my-bucket resources/test.txt file_encrypted.txt QxhqaZEqBGVTW55HhQw9Q=
  node encryption download my-bucket file_encrypted.txt ./file.txt QxhqaZEqBGVTW55HhQw9Q=
  node encryption rotate my-bucket file_encrypted.txt QxhqaZEqBGVTW55HhQw9Q= SxafpsdfSDFS89sds9Q=