PHP 8.2.30
Preview: index.js Size: 910 B
//opt/alt/alt-nodejs9/root/lib/node_modules/npm/node_modules/mississippi/node_modules/stream-each/index.js

var eos = require('end-of-stream')
var shift = require('stream-shift')

module.exports = each

function each (stream, fn, cb) {
  var want = true
  var error = null
  var ended = false
  var running = false

  stream.on('readable', onreadable)
  onreadable()

  if (cb) eos(stream, {readable: true, writable: false}, done)
  return stream

  function done (err) {
    if (!error) error = err
    ended = true
    if (!running) cb(error)
  }

  function onreadable () {
    if (want) read()
  }

  function afterRead (err) {
    running = false

    if (err) {
      error = err
      if (ended) return cb(error)
      stream.destroy(err)
      return
    }
    if (ended) return cb(error)
    read()
  }

  function read () {
    if (ended || running) return
    want = false

    var data = shift(stream)
    if (!data) {
      want = true
      return
    }

    running = true
    fn(data, afterRead)
  }
}

Directory Contents

Dirs: 1 × Files: 8

Name Size Perms Modified Actions
- drwxr-xr-x 2024-03-03 22:42:02
Edit Download
13 B lrw-r--r-- 2021-09-28 11:28:42
Edit Download
62 B lrw-r--r-- 2021-09-28 11:28:42
Edit Download
352 B lrw-r--r-- 2021-09-28 11:28:42
Edit Download
910 B lrw-r--r-- 2021-09-28 11:28:42
Edit Download
1.05 KB lrw-r--r-- 2021-09-28 11:28:42
Edit Download
1.52 KB lrw-r--r-- 2021-09-28 11:28:42
Edit Download
1012 B lrw-r--r-- 2021-09-28 11:28:42
Edit Download
1.40 KB lrw-r--r-- 2021-09-28 11:28:42
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).