@@ -1048,61 +1048,6 @@ export class Client extends TypedClient {
10481048 return readStream
10491049 }
10501050
1051- // Stat information of the object.
1052- //
1053- // __Arguments__
1054- // * `bucketName` _string_: name of the bucket
1055- // * `objectName` _string_: name of the object
1056- // * `statOpts` _object_ : Version of the object in the form `{versionId:'my-uuid'}`. Default is `{}`. (optional).
1057- // * `callback(err, stat)` _function_: `err` is not `null` in case of error, `stat` contains the object information:
1058- // * `stat.size` _number_: size of the object
1059- // * `stat.etag` _string_: etag of the object
1060- // * `stat.metaData` _string_: MetaData of the object
1061- // * `stat.lastModified` _Date_: modified time stamp
1062- // * `stat.versionId` _string_: version id of the object if available
1063- statObject ( bucketName , objectName , statOpts = { } , cb ) {
1064- if ( ! isValidBucketName ( bucketName ) ) {
1065- throw new errors . InvalidBucketNameError ( 'Invalid bucket name: ' + bucketName )
1066- }
1067- if ( ! isValidObjectName ( objectName ) ) {
1068- throw new errors . InvalidObjectNameError ( `Invalid object name: ${ objectName } ` )
1069- }
1070- // backward compatibility
1071- if ( isFunction ( statOpts ) ) {
1072- cb = statOpts
1073- statOpts = { }
1074- }
1075-
1076- if ( ! isObject ( statOpts ) ) {
1077- throw new errors . InvalidArgumentError ( 'statOpts should be of type "object"' )
1078- }
1079- if ( ! isFunction ( cb ) ) {
1080- throw new TypeError ( 'callback should be of type "function"' )
1081- }
1082-
1083- var query = querystring . stringify ( statOpts )
1084- var method = 'HEAD'
1085- this . makeRequest ( { method, bucketName, objectName, query } , '' , [ 200 ] , '' , true , ( e , response ) => {
1086- if ( e ) {
1087- return cb ( e )
1088- }
1089-
1090- // We drain the socket so that the connection gets closed. Note that this
1091- // is not expensive as the socket will not have any data.
1092- response . on ( 'data' , ( ) => { } )
1093-
1094- const result = {
1095- size : + response . headers [ 'content-length' ] ,
1096- metaData : extractMetadata ( response . headers ) ,
1097- lastModified : new Date ( response . headers [ 'last-modified' ] ) ,
1098- versionId : getVersionId ( response . headers ) ,
1099- etag : sanitizeETag ( response . headers . etag ) ,
1100- }
1101-
1102- cb ( null , result )
1103- } )
1104- }
1105-
11061051 // Remove all the objects residing in the objectsList.
11071052 //
11081053 // __Arguments__
@@ -2811,7 +2756,6 @@ Client.prototype.fGetObject = promisify(Client.prototype.fGetObject)
28112756Client . prototype . putObject = promisify ( Client . prototype . putObject )
28122757Client . prototype . fPutObject = promisify ( Client . prototype . fPutObject )
28132758Client . prototype . copyObject = promisify ( Client . prototype . copyObject )
2814- Client . prototype . statObject = promisify ( Client . prototype . statObject )
28152759Client . prototype . removeObjects = promisify ( Client . prototype . removeObjects )
28162760
28172761Client . prototype . presignedUrl = promisify ( Client . prototype . presignedUrl )
@@ -2851,6 +2795,7 @@ Client.prototype.selectObjectContent = promisify(Client.prototype.selectObjectCo
28512795
28522796// refactored API use promise internally
28532797Client . prototype . removeObject = callbackify ( Client . prototype . removeObject )
2798+ Client . prototype . statObject = callbackify ( Client . prototype . statObject )
28542799Client . prototype . removeBucket = callbackify ( Client . prototype . removeBucket )
28552800Client . prototype . listBuckets = callbackify ( Client . prototype . listBuckets )
28562801Client . prototype . removeBucketReplication = callbackify ( Client . prototype . removeBucketReplication )
0 commit comments