Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../uploads/../../../../instantly.picotech.app/homes/../../wa.picotech.app/public_html/node_modules/escape-html/.././object-assign/../@hapi/../inherits/../punycode/../lodash.clonedeep/../dotenv/../fresh/../.bin/../express-validator/../thread-stream/test
الملفات الموجودة في هذا الـ Path:
.
..
base.test.js
bench.test.js
bundlers.test.js
close-on-gc.js
commonjs-fallback.test.js
create-and-exit.js
custom-worker.js
dir with spaces
end.test.js
error.js
esm.test.mjs
exit.js
helper.d.ts
helper.js
indexes.js
multibyte-chars.test.mjs
port.js
string-limit-2.test.js
string-limit.test.js
thread-management.test.js
to-file-on-destroy.js
to-file-on-final.js
to-file.js
to-file.mjs
transpiled.test.js
ts
ts.test.ts
uncaughtException.js
unhandledRejection.js

مشاهدة ملف: bench.test.js

'use strict'

const { test } = require('tap')
const { join } = require('path')
const ThreadStream = require('..')
const { file } = require('./helper')

const MAX = 1000

let str = ''

for (let i = 0; i < 10; i++) {
  str += 'hello'
}

test('base', function (t) {
  const dest = file()
  const stream = new ThreadStream({
    filename: join(__dirname, 'to-file.js'),
    workerData: { dest }
  })
  let runs = 0
  function benchThreadStream () {
    if (++runs === 1000) {
      stream.end()
      return
    }

    for (let i = 0; i < MAX; i++) {
      stream.write(str)
    }
    setImmediate(benchThreadStream)
  }
  benchThreadStream()
  stream.on('finish', function () {
    t.end()
  })
})