ByteNote LogoByteNote

Navigation

  • Blog
  • 工具

    © 2025 ByteNote. All rights reserved.

    Python flask 静态服务

    Jul 7, 20223 min read
    @app.route('/uploads/<path:filename>')
    def download_file(filename):
        return send_from_directory(app.config['UPLOAD_FOLDER'],
                                   filename, as_attachment=True)
    

    参数说明

    directory – the directory where all the files are stored.
    filename – the filename relative to that directory to download.
    options – optional keyword arguments that are directly forwarded to send_file().

    相关文章

    ChatGPT 账号被封的解决方案

    可以通过访问 help.openai.com 使用聊天小机器人提交投诉信,或联系ChatGPT的官方社交媒体账号解决账号被封问题,同时注意遵守社交媒体政策。

    解决 dyld Library not loaded usrlocalopticu4cliblibicui18n

    解决 `dyld: Library not loaded` 错误的方法包括卸载并重新安装 `node` 和 `icu4c`,以及使用 `npm` 全局安装 `pnpm`。

    在JavaScript中创建一个同步锁

    JavaScript中可以使用Promise和async/await实现同步锁功能,通过`lock`和`unlock`方法控制锁定和解锁,确保在特定情况下的数据正确性。

    JS Blob、ArrayBuffer和Buffer 的使用

    JS中有三种二进制数据类型:Blob用于处理文件和二进制数据,ArrayBuffer用于存储固定大小的二进制数据,Buffer是Node.js中用于处理网络和文件系统的二进制数据类型。

    Swift 整形和浮点型进行类型推导的默认类型

    Swift中整型和浮点型进行类型推导时,整型默认是Int,浮点型默认是Double。