|
|
@ -36,7 +36,7 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 { |
|
|
|
await waitForStreamClose(createStream); |
|
|
|
await waitForStreamClose(createStream); |
|
|
|
await this.fileCreate('nc-test-file.txt', { |
|
|
|
await this.fileCreate('nc-test-file.txt', { |
|
|
|
path: tempFile, |
|
|
|
path: tempFile, |
|
|
|
mimetype: '', |
|
|
|
mimetype: 'text/plain', |
|
|
|
originalname: 'temp.txt', |
|
|
|
originalname: 'temp.txt', |
|
|
|
size: '', |
|
|
|
size: '', |
|
|
|
}); |
|
|
|
}); |
|
|
@ -68,6 +68,7 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 { |
|
|
|
async fileCreate(key: string, file: XcFile): Promise<any> { |
|
|
|
async fileCreate(key: string, file: XcFile): Promise<any> { |
|
|
|
const uploadParams: any = { |
|
|
|
const uploadParams: any = { |
|
|
|
ACL: 'public-read', |
|
|
|
ACL: 'public-read', |
|
|
|
|
|
|
|
ContentType: file.mimetype, |
|
|
|
}; |
|
|
|
}; |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
// Configure the file stream and obtain the upload parameters
|
|
|
|
// Configure the file stream and obtain the upload parameters
|
|
|
@ -104,11 +105,12 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 { |
|
|
|
url: url, |
|
|
|
url: url, |
|
|
|
encoding: null, |
|
|
|
encoding: null, |
|
|
|
}, |
|
|
|
}, |
|
|
|
(err, _, body) => { |
|
|
|
(err, httpResponse, body) => { |
|
|
|
if (err) return reject(err); |
|
|
|
if (err) return reject(err); |
|
|
|
|
|
|
|
|
|
|
|
uploadParams.Body = body; |
|
|
|
uploadParams.Body = body; |
|
|
|
uploadParams.Key = key; |
|
|
|
uploadParams.Key = key; |
|
|
|
|
|
|
|
uploadParams.ContentType = httpResponse.headers['content-type']; |
|
|
|
|
|
|
|
|
|
|
|
// call S3 to retrieve upload file to specified bucket
|
|
|
|
// call S3 to retrieve upload file to specified bucket
|
|
|
|
this.s3Client.upload(uploadParams, (err1, data) => { |
|
|
|
this.s3Client.upload(uploadParams, (err1, data) => { |
|
|
|