def save_file(filename, data, dirName):
    """
    @brief      Saves raw data to file.
    @param      filename  String
    @param      data      Binary data
    @param      dirName   String
    @return     file path
    """
    Log.debug('save file: ' + filename)
    fn = filename
    if not os.path.exists(dirName):
        os.makedirs(dirName)
    fn = os.path.join(dirName, filename)
    with open(fn, 'wb') as f:
        f.write(data)
    return fn

    @brief      Saves raw data to file.
    @param      filename  String
    @param      data      Binary data
    @param      dirName   String
    @return     file path
    
wxbot_project_py2.7/wechat/utils.py