Skip to content

storage: bucket.upload #167

Description

@ryanseys

We can make a simple wrapper method for quick and easy file uploading:

var gcloud = require('gcloud');
var storage = gcloud.storage;

var bucket = new storage.Bucket({
  bucketName: YOUR_BUCKET_NAME,
  keyFilename: '/path/to/the/key.json'
});

bucket.upload('local_filename.jpg', 'remotename.jpg', function(err) {
  console.log(err || 'File uploaded successfully!');
});

Activity

  1. stephenplusplus commented on Sep 4, 2014

    @stephenplusplus
    Contributor

    What about:

    // Will upload with same filename.
    bucket.upload('local_filename.jpg', function(err) {});

    or and also allowing a config object:

    bucket.upload('local_filename.jpg', {
      name: 'remotename.jpg'
      // other metadata
    }, function(err) {});
  2. ryanseys commented on Sep 4, 2014

    @ryanseys
    ContributorAuthor

    Sure, yes. Both together would be a complete solution.

  3. stephenplusplus commented on Sep 21, 2014

    @stephenplusplus
    Contributor

    This is part of the Storage API overhaul: #194

  4. added this to the Storage Stable milestone on Feb 2, 2015
  5. added a commit that references this issue on Aug 22, 2022
  6. 49 remaining items

  7. added a commit that references this issue on Mar 18, 2026
    5f64bfe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions