aws-v3-sdk 1.0.32 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/clients/s3.js +25 -1
  2. package/package.json +1 -1
package/clients/s3.js CHANGED
@@ -1,4 +1,4 @@
1
- const { S3Client, GetObjectCommand, PutObjectCommand, ListObjectsCommand, DeleteObjectsCommand, CreateMultipartUploadCommand, CompleteMultipartUploadCommand, UploadPartCommand } = require('@aws-sdk/client-s3')
1
+ const { S3Client, GetObjectCommand, PutObjectCommand, HeadObjectCommand, ListObjectsCommand, DeleteObjectsCommand, CreateMultipartUploadCommand, CompleteMultipartUploadCommand, UploadPartCommand } = require('@aws-sdk/client-s3')
2
2
  const { getSignedUrl } = require('@aws-sdk/s3-request-presigner')
3
3
 
4
4
  const { Agent } = require('https')
@@ -147,6 +147,30 @@ class S3 {
147
147
  return Promise.reject(error)
148
148
  })
149
149
  }
150
+
151
+ headObject (params, callback) {
152
+ return new Promise((resolve, reject) => {
153
+ const headObject = new HeadObjectCommand(params)
154
+ client.send(headObject, (err, data) => {
155
+ if (err || !data) {
156
+ resolve(err)
157
+ }
158
+ if (data) {
159
+ resolve(data)
160
+ }
161
+ })
162
+ }).then(result => {
163
+ if (callback && typeof callback === 'function') {
164
+ callback(null, result)
165
+ }
166
+ return result
167
+ }).catch(error => {
168
+ if (callback && typeof callback === 'function') {
169
+ callback(error, null)
170
+ }
171
+ return Promise.reject(error)
172
+ })
173
+ }
150
174
  }
151
175
 
152
176
  module.exports = S3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-v3-sdk",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "AWS v3 SDK Utils",
5
5
  "main": "index.js",
6
6
  "scripts": {