Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a warning to the storage/file#move method. #544

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions lib/storage/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,18 @@ File.prototype.copy = function(destination, callback) {
};

/**
* Move this file to another location. By default, this will move
* the file to the same bucket, but you can choose to move it
* Move this file to another location. By default, this will move
* the file to the same bucket, but you can choose to move it
* to another Bucket by providing either a Bucket or File object.
*
* **Warning**:
* There is currently no atomic `move` method in the Google Cloud Storage API,
* so this method is a composition of {module:storage/file#copy}
* (to the new location) and {module:storage/file#delete} (from the old location).
* While unlikely, it is possible that your error callback function could
* mean that the either one of these API calls failed -- and may leave a
* duplicate file lingering.
*
* @throws {Error} If the destination file is not provided.
*
* @param {string|module:storage/bucket|module:storage/file} destination -
Expand All @@ -265,7 +273,7 @@ File.prototype.copy = function(destination, callback) {
* // but contains instead:
* // - "my-image-new.png"
*
* // `destinationFile` is an instance of a File object that refers
* // `destinationFile` is an instance of a File object that refers
* // to your new file.
* });
*
Expand All @@ -281,7 +289,7 @@ File.prototype.copy = function(destination, callback) {
* // `another-bucket` now contains:
* // - "my-image.png"
*
* // `destinationFile` is an instance of a File object that refers
* // `destinationFile` is an instance of a File object that refers
* // to your new file.
* });
*
Expand Down