阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js new Worker

      Node.js new Worker(filename[, options])

      • filename < string> The path to the Worker’s main script. Must be either an absolute path or a relative path (i.e. relative to the current working directory) starting with ./ or ../. If options.eval is true, this is a string containing JavaScript code rather than a path.
      • options < Object>
        • eval < boolean> If true, interpret the first argument to the constructor as a script that is executed once the worker is online.
        • workerData < any> Any JavaScript value that will be cloned and made available as require(‘worker_threads’).workerData. The cloning will occur as described in the HTML structured clone algorithm, and an error will be thrown if the object cannot be cloned (e.g. because it contains functions).
        • stdin < boolean> If this is set to true, then worker.stdin will provide a writable stream whose contents will appear as process.stdin inside the Worker. By default, no data is provided.
        • stdout < boolean> If this is set to true, then worker.stdout will not automatically be piped through to process.stdout in the parent.
        • stderr < boolean> If this is set to true, then worker.stderr will not automatically be piped through to process.stderr in the parent.

      更多内容请参考:Node.js worker_threads 工作线程,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录