const filePath = "temp-file-to-upload" // 本地文件路径cos.putObject({Bucket: 'examplebucket-1250000000',Region: 'COS_REGION',Key: 'exampleobject',Body: fs.createReadStream(filePath), // 上传文件对象Headers: {// 万象持久化接口,上传时持久化'Pic-Operations': '{"is_pic_info": 1, "rules": [{"fileid": "desample_photo.jpg", "rule": "watermark/3/type/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn"}]}'},}, function(err, data) {console.log(err || data);});
cos.getObject({Bucket: 'examplebucket-1250000000',Region: 'COS_REGION',Key: 'exampleobject',QueryString: 'watermark/3/type/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn',}, function (err, data) {console.log(err || data);fs.writeFileSync('filepath', data.Body); // 将图片内容保存本地});
本页内容是否解决了您的问题?