src/utils/npm-audit-package.js
function removePackageTarFileFrom(projectDir, response) {
    try {
        const file = pathJoin(projectDir, response.filename);
        unlink(file);
        return response;
    } catch (error) {
        if (error.code === 'ENOENT') {
            return response;
        }
        if (response) {
            response.internalErrors = response.internalErrors || [];
            response.internalErrors.push(error);
            return response;
        }
        return response;
    }
}
function removePackageTarFileFrom(projectDir, response) {
    try {
        const file = pathJoin(projectDir, response.filename);
        unlink(file);
        return response;
    } catch (error) {
        if (error.code === 'ENOENT') {
            return response;
        }
        if (response) {
            response.internalErrors = response.internalErrors || [];
            response.internalErrors.push(error);
            return response;
        }
        return response;
    }
}
function removePackageTarFileFrom ( projectDir , response ) { try { const file = pathJoin ( projectDir , response . filename ) ; unlink ( file ) ; return response ; } catch ( error ) { if ( error . code === 'ENOENT' ) { return response ; } if ( response ) { response . internalErrors = response . internalErrors || [ ] ; response . internalErrors . push ( error ) ; return response ; } return response ; } }
Middleware that removes the auto-generated package tar file
@param {string} projectDir - folder where the tar file has been generated
@param {*} response - result of the npm pack command (eventually modified by previous middlewares execution)
@returns input response if file removal is ok
In case of error it adds or updates into the input response object the property 'internalErrors'
Middleware that removes the auto - generated package tar file