delet blob wip
This commit is contained in:
@@ -170,6 +170,35 @@ export const deleteBlob = async (containerName, blobName) => {
|
||||
return { "deleted": blobName };
|
||||
};
|
||||
|
||||
export const deleteBlobCase = async (containerName, blobName) => {
|
||||
const creds = new DefaultAzureCredential();
|
||||
|
||||
const options = {
|
||||
deleteSnapshots: "include", // or 'only'
|
||||
};
|
||||
|
||||
const containerClient = new ContainerClient(
|
||||
`${STORAGE_PATH}/${containerName}`,
|
||||
creds
|
||||
);
|
||||
|
||||
console.log("blob to delete:", blobName);
|
||||
|
||||
for await (const blob of containerClient.listBlobsFlat({
|
||||
prefix: blobName,
|
||||
})) {
|
||||
console.log(" ------ :", blob.name);
|
||||
containerClient.deleteBlob(blob.name);
|
||||
}
|
||||
|
||||
containerClient.deleteBlob(blobName);
|
||||
console.log(`deleted blob ${blobName}`);
|
||||
for await (const blob of containerClient.listBlobsFlat()) {
|
||||
console.log(" ------ :", blob.name);
|
||||
}
|
||||
return { "deleted": blobName };
|
||||
};
|
||||
|
||||
export const uploadFile = async (formContent, containerName, foldername) => {
|
||||
const creds = new DefaultAzureCredential();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user