• File: port.js
  • Full Path: /var/www/nodejs/simo_meps_file_script/node_modules/thread-stream/test/port.js
  • Date Modified: 02/28/2025 8:55 PM
  • File size: 263 bytes
  • MIME-type: text/plain
  • Charset: utf-8
'use strict'

const { Writable } = require('stream')

function run (opts) {
  const { port } = opts
  return new Writable({
    autoDestroy: true,
    write (chunk, enc, cb) {
      port.postMessage(chunk.toString())
      cb()
    }
  })
}

module.exports = run