0

I am currently having a project where I will upload some files in the Blob Container and there are instances that I also want to permanently delete some files but it should be through JavaScript. Are there any ways?

SuperStormer
  • 4,997
  • 5
  • 25
  • 35

1 Answers1

1

Try this :

const {
    BlobServiceClient
  } = require("@azure/storage-blob");

  const connectionString = '<storage connection string>'
  const container = '<container name>'
  const blob = '<blob name>'

  const blobClient = BlobServiceClient.fromConnectionString(connectionString).getContainerClient(container).getBlobClient(blob);
  blobClient.deleteIfExists().then(result =>{console.log(result._response.status + " blob removed")})

Let me know if you have any more questions.

Stanley Gong
  • 11,522
  • 1
  • 8
  • 16