Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • G gulp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gulp
  • gulp
  • Issues
  • #2380
Closed
Open
Issue created Sep 28, 2019 by Craig P Hicks@craigphicks

writing-a-plugin "Call the callback function only when the current file (stream/buffer) is completely consumed"

What were you expecting to happen?

Following the verbal guidance here -

"Call the callback function only when the current file (stream/buffer) is completely consumed"

then in case of file.IsStream() I expected to need to wait for the 'end' event from the inner transform before calling the callback().

What actually happened?

As shown in the code example on that man page, it only works if callback() is called immediately.

Please post a sample of your gulpfile (preferably reduced to just the bit that's not working)

    innerTransform.on('end', () => {
      cb(null, file) // gulp writes an empty file doing it this way
    })

Actually implementing the above code (instead of calling the callback immediately), resulted in an empty file being written, although the inner transform had dutifully pushed all the data.

What version of gulp are you using? gulp 4

What versions of npm and node are you using? npm 6.9.0 gulp 4.0.2


I am unable to convince myself that

when the current file (stream/buffer) is completely consumed

could mean anything other than the end event has been emitted. Furthermore, the wording seems perfect from a design point of view, and fits with all the usage of callbacks that I know.

How to reconcile the words and the actual design?

Assignee
Assign to
Time tracking