2.0.0 • Published 7 years ago

sand-google-storage v2.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

Google Storage Sand Grain

Config

namedescription
bucketThe name of the main bucket
tmpBucketThe name of the temporary bucket

Usage

const storage = require('sand-googled-storage');

new Sand()
	.use(storage)
	.start();
// Read a file from google storage
sand.storage.bucket().file('myFile.jpg').createReadStream();

// Write a file to google storage
sand.storage.bucket().file('myFile.jpg').createWriteStream();

Methods

Sand Grain

Methods that are attached to sand.storage

storage()

Returns a new Storage Object

bucket(name)

Set the bucket or use the default set in the config. Returns a new Storage Object

tmpBucket(name)

Set the tmp bucket or use the default set in the config. Returns a new Storage Object

file(path)

Set the file path to a file for uploading or reading. Returns a new Storaged Object

Storage

Methods that are on the Storage Object

createReadStream()

Returns a new read stream to download file

createWriteStream()

Returns a new write stream to upload file

download(options)

Download a file into memory or a file with passed in options.destination

deleteFiles()

Delete Files that matched query Some Options

deleteFile(path)

Delete file at path in current bucket

delete()

Delete the current file in the current bucket