IPWorks S3 2020 Node.js Edition

Questions / Feedback?

DeleteObject Method

Deletes an object.


s3client.deleteObject(objectName, [callback])


The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:



This method deletes the object specified by ObjectName in the bucket currently selected by Bucket.

If the VersionId property is non-empty, this method deletes the specified version of the object instead.

Deleting Versioned Objects

If a bucket has versioning enabled (i.e., VersioningEnabled returns true when queried), and this method is called on an object rather than a specific object version, then instead of actually deleting any data, the server will simply create a special object version called a delete marker.

If an object's latest version is a delete marker, then the server treats the object as if it didn't exist (i.e., it doesn't appear when listing objects, cannot be downloaded, etc.). However, all of the previous versions of the object (including one that existed just before the delete marker was created) still exist; they can be listed using ListVersions, and explicitly interacted with by setting VersionId and calling an appropriate method.

To permanently delete objects in a versioning-enabled bucket, each version of the object must be explicitly deleted by setting VersionId before calling this method. This includes any delete marker versions, which can be deleted like any other version.

Refer to Amazon's Deleting Object Versions, Working with Delete Markers, and Removing Delete Markers articles for more information.

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks S3 2020 Node.js Edition - Version 20.0 [Build 7722]