Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 2x 4x 4x 4x 1x 1x 3x 3x 2x 8x 8x 8x | import { ContainerClient } from '@azure/storage-blob'
import { Logger } from '@azure/functions'
export function removeOldFunctionFromStorage(
oldZipUrl: string,
newZipUrl: string,
storageClient: ContainerClient,
logger?: Logger
) {
const oldZipName = extractBlobName(oldZipUrl)
const newZipName = extractBlobName(newZipUrl)
if (oldZipName === newZipName) {
logger?.verbose('Old function zip is the same as the new one, skipping removal')
return
}
logger?.verbose(`Removing old function zip file ${oldZipName} from storage`)
return storageClient.deleteBlob(oldZipName)
}
export function extractBlobName(fileUrl: string) {
const url = new URL(fileUrl)
const zipUrlParts = url.pathname.split('/')
return zipUrlParts[zipUrlParts.length - 1]
}
|