ByteNote LogoByteNote

Navigation

  • Blog
  • 工具

    © 2025 ByteNote. All rights reserved.

    Using async:await with a forEach loop

    Oct 25, 20217 min read

    If you want to read the files in sequence, you cannot use forEach indeed. Just use a modern for … of loop instead, in which await will work as expected:

    async function printFiles () {
      const files = await getFilePaths();
    
      for (const file of files) {
        const contents = await fs.readFile(file, 'utf8');
        console.log(contents);
      }
    }
    

    相关文章

    文库网站是如何实现的?

    文库网站通过用户上传文档、服务器存储、数据库管理、搜索功能和文档下载等步骤,实现文档的在线存储和检索。

    Form-create 全局校验api

    Form-create 全局校验api用于在添加操作前验证表单,并在验证通过后打开抽屉。

    Go 各环境中的交叉编译命令

    本文介绍了如何在Mac、Linux和Windows环境下使用Go语言进行交叉编译,生成适用于不同操作系统和体系架构的64位可执行程序,并强调了在交叉编译过程中禁用CGO的重要性。

    Go unipdf库的使用

    Go Unipdf是一个Go语言的PDF库,支持创建、处理和编辑PDF文档,其基本使用步骤包括导入库、创建文档、添加页面和内容,以及保存文档。

    在 Flutter 中,可以使用 Theme

    在 Flutter 中,使用 `Theme.of(context).brightness` 属性可以判断当前是否为暗色模式。