@novo-x/google-storage
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Google Cloud Storage Service

Available methods

  • getAllBuckets: retrieves all buckets
  • getBucket: retrieves a bucket
  • createBucket: creates a bucket
  • deleteBucket: deletes a bucket
  • uploadFile: uploads a file
  • deleteFile: deletes a file
  • copyFile: copies a file between buckets
  • getSignedUrlForFile: retrieves a signed url for a file
  • downloadFileToMemory: downloads a file into memory
  • makeFilePublic: makes a file public
  • makeFilePrivate: makes a file private

Usage examples

yarn add @novo-x/googlecloud-storage

import {GoogleStorage} from "@novo-x/google-storage"

const MyService = new GoogleStorage({
    // optional storage options
});

const buckets = await MyService.getAllBuckets({
    // optional get options
});

const bucket = await MyService.getBucket(
    'my-bucket', // bucket name
    {
        // optional get options
    }
);

const createdBucket = await MyService.createBucket(
    'my-bucket', // bucket name
    {
        // optional creation options
    }
);

const deletedBucket = await MyService.deleteBucket(
    'my-bucket', // bucket name
    {
        // optional get bucket options
    },
    {
        // optional delete bucket options
    }
);

const uploadedFile = await MyService.uploadFile(
    'my-bucket', // bucket name
    'my-file', // file name
    {
        // optional get bucket options
    },
    {
        // optional upload options
    }
);

const deletedFile = await MyService.deleteFile(
    'my-bucket', // bucket name
    'my-file', // file name
    {
        // optional get bucket options
    },
    {
        // optional delete options
    }
);

const copiedFile = await MyService.copyFile(
    'my-bucket', // source bucket name
    'my-file', // file name,
    'other-bucket', // destination bucket
    {
        // optional get source bucket options
    },
    {
        // optional get destination bucket options
    }
);

const signedUrl = await MyService.getSignedUrlForFile(
    'my-bucket', // bucket name
    'my-file', // file name,
    {
        // required signed url options
    }
);

const downloaded = await MyService.downloadFileToMemory(
    'my-bucket', // bucket name
    'my-file', // file name,
    {
        // optional download options
    }
);

const privateFile = await MyService.makeFilePrivate(
    'my-bucket', // bucket name
    'my-file', // file name
    {
        // optional request options
    }
);

const publicFile = await MyService.makeFilePublic(
    'my-bucket', // bucket name
    'my-file' // file name,
);

Dependencies

@google-cloud/storage

Package Sidebar

Install

npm i @novo-x/google-storage

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

39.8 kB

Total Files

6

Last publish

Collaborators

  • lautarobruno
  • agustin-novolabs
  • novo-tincho
  • nicolas.novolabs
  • mati-novolabs
  • alejitowow
  • nahuelprieto