public async deleteFile()

in src/appservice-rest/Kudu/azure-app-kudu-service.ts [475:499]


    public async deleteFile(physicalPath: string, fileName: string): Promise<void> {
        physicalPath = physicalPath.replace(/[\\]/g, "/");
        physicalPath = physicalPath[0] == "/" ? physicalPath.slice(1): physicalPath;
        var httpRequest: WebRequest = {
            method: 'DELETE',
            uri: this._client.getRequestUri(`/api/vfs/${physicalPath}/${fileName}`),
            headers: {
                'If-Match': '*'
            }
        };

        try {
            var response = await this._client.beginRequest(httpRequest);
            core.debug(`deleteFile. Data: ${JSON.stringify(response)}`);
            if([200, 201, 204, 404].indexOf(response.statusCode) != -1) {
                return ;
            }
            else {
                throw response;
            }
        }
        catch(error) {
            throw Error("Failed to delete file " + physicalPath + fileName + " from Kudu.\n" + this._getFormattedError(error));;
        }
    }