@@ -21,19 +21,9 @@ export type Options = {
2121 dryRun ?: boolean ;
2222 cacheControl ?: string | { [ key : string ] : string } ;
2323 s3Client ?: S3 ;
24- accessControlLevel ?: ObjectACL ;
24+ accessControlLevel ?: S3 . ObjectCannedACL ;
2525} ;
2626
27- export type ObjectACL =
28- | 'private'
29- | 'public-read'
30- | 'public-read-write'
31- | 'authenticated-read'
32- | 'aws-exec-read'
33- | 'bucket-owner-read'
34- | 'bucket-owner-full-control'
35- | string ;
36-
3727const defaultOptions = {
3828 dryRun : false ,
3929 concurrency : 100 ,
@@ -119,24 +109,15 @@ export default class Uploader {
119109 public uploadFile ( localFilePath : string , remotePath : string ) : Promise < void > {
120110 const body = fs . createReadStream ( localFilePath ) ;
121111 const { dryRun, bucket : Bucket , accessControlLevel : ACL } = this . options ;
122- let params ;
112+ const params : S3 . PutObjectRequest = {
113+ Bucket,
114+ Key : remotePath . replace ( / \\ / g, '/' ) ,
115+ Body : body ,
116+ ContentType : mime . getType ( localFilePath ) ,
117+ CacheControl : this . getCacheControlValue ( localFilePath ) ,
118+ } ;
123119 if ( ACL ) {
124- params = {
125- ACL ,
126- Bucket,
127- Key : remotePath . replace ( / \\ / g, '/' ) ,
128- Body : body ,
129- ContentType : mime . getType ( localFilePath ) ,
130- CacheControl : this . getCacheControlValue ( localFilePath ) ,
131- } ;
132- } else {
133- params = {
134- Bucket,
135- Key : remotePath . replace ( / \\ / g, '/' ) ,
136- Body : body ,
137- ContentType : mime . getType ( localFilePath ) ,
138- CacheControl : this . getCacheControlValue ( localFilePath ) ,
139- } ;
120+ params . ACL = ACL ;
140121 }
141122
142123 return new Promise ( resolve => {
0 commit comments