function validateAudioFile(filePath){
    try {
        var buffer = readChunk.sync(filePath, 0, 262);
    } catch(e){
        logger.error(e);
        return false;
    }
    var type = fileType(buffer);
    if(type == null){
        logger.info("Not a known file type: " + filePath);
        return false;
    }
    if( type.ext == 'wav' && (type.mime == 'audio/wav' || type.mime == 'audio/x-wav')) {
        return true;
    } else if (type.ext == 'mp3' && type.mime == 'audio/mpeg') {
        return true;
    } else {
        logger.info("Invalid audio type: " + filePath + " " + type.mime);
        return false;
    }
}
/**
 * Validate audio file
 * @param filePath {String} Path of the file to validate
 * @returns {boolean} isValid If the file is a valid audio file
 */
Validate audio file
@param filePath {String} Path of the file to validate
@returns {boolean} isValid If the file is a valid audio file
Validate audio file @param filePath { String } Path of the file to validate @returns { boolean } isValid If the file is a valid audio file
function validateAudioFile(filePath){
    try {
        var buffer = readChunk.sync(filePath, 0, 262);
    } catch(e){
        logger.error(e);
        return false;
    }
    var type = fileType(buffer);
    if(type == null){
        logger.info("Not a known file type: " + filePath);
        return false;
    }
    if( type.ext == 'wav' && (type.mime == 'audio/wav' || type.mime == 'audio/x-wav')) {
        return true;
    } else if (type.ext == 'mp3' && type.mime == 'audio/mpeg') {
        return true;
    } else {
        logger.info("Invalid audio type: " + filePath + " " + type.mime);
        return false;
    }
}
function validateAudioFile ( filePath ) { try { var buffer = readChunk . sync ( filePath , 0 , 262 ) ; } catch ( e ) { logger . error ( e ) ; return false ; } var type = fileType ( buffer ) ; if ( type == null ) { logger . info ( "Not a known file type: " + filePath ) ; return false ; } if ( type . ext == 'wav' && ( type . mime == 'audio/wav' || type . mime == 'audio/x-wav' ) ) { return true ; } else if ( type . ext == 'mp3' && type . mime == 'audio/mpeg' ) { return true ; } else { logger . info ( "Invalid audio type: " + filePath + " " + type . mime ) ; return false ; } }
Validate audio file
 @param filePath {String} Path of the file to validate
 @returns {boolean} isValid If the file is a valid audio file
Validate audio file @param filePath { String } Path of the file to validate @returns { boolean } isValid If the file is a valid audio file