What should be passed in to delete Aliyun oss?


delete:

var co = require("co");
var OSS = require("ali-oss")
var client = new OSS({
  region: "<Your region>",
  accessKeyId: "<Your AccessKeyId>",
  accessKeySecret: "<Your AccessKeySecret>",
  bucket: "Your bucket name"
});
co(function* () {
  var result = yield client.delete("object-key");
  console.log(result);
}).catch(function (err) {
  console.log(err);
});

above is the code for deleting files in Aliyun oss nodejs sdk. I would like to ask you what the object-key passed in should be? I passed in the file address on oss and cannot delete it.

Mar.18,2021

it is recommended to take a look at introduction to basic concepts . Object-key is the only key,URL that stores files, which is used for access and sharing. If you manage files, you certainly won't use them, just as you delete server files and you won't delete them by URL. Just think of OSS as a file system.

Menu