huaweicloud / huaweicloud-sdk-nodejs-obs

Apache License 2.0
27 stars 10 forks source link

Upload Image in Storage Service #24

Open praveenGammastack opened 10 months ago

praveenGammastack commented 10 months ago

Hello, I have to upload image on storage service and I need to upload it in buffer in nodejs .

I am using following code let newObsClient = new ObsClient({ access_key_id: config.get('storageService.accessKey'), secret_access_key: config.get('storageService.secretKey'), server : config.get('storageService.url') }); const res = await newObsClient.putObject({ Bucket : config.get('storageService.bucket'), Key : fileName, Body: profileImage.buffer, ContentType: 'image/jpeg', EncodingType: 'binary', });

I have also used some other methods to upload it , Please can anyone help here.

Thanks
liqiuqiu111 commented 8 months ago

https://support.huaweicloud.com/sdk-nodejs-devg-obs/obs_29_0403.html,使用stream.Readable作为对象的数据源