Pipe node package into gulp

I was just curious if it was possible to pipe in a node package to a gulp stream in order to pass it to a destination.

For this particular example I'm trying to pipe the output of the plist node package to file. I realize I can use the fs package to do this without gulp, but was trying to keep things consistent. Also would be helpful to know for future use if I need to pipe other plugin output.

I'm getting the error TypeError: Object <?xml ...> has no method 'on'

Here's my task:

var gulp = require('gulp'),
    plist = require('plist')
;

gulp.src('./')
  .pipe(plist.build(iosPlist))
  .pipe(gulp.dest("ios.plist"))
;

Link to package, if needed: https://www.npmjs.org/package/plist

I've had a similar issue, when I wanted to modify plist file with values from another file.

For example, suppose we have plist like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>name</key>
    <string>aaa</string>
  </dict>
</plist>

With gulp-tap plugin it is possible to modify contents of the file within the given pipeline.

The actual sample code (coffeescript):

gulp = require 'gulp'
plist = require 'plist'
tap = require 'gulp-tap'

gulp.task 'plist', ->
gulp.src("./test.plist")
.pipe(tap((file)->
  src_file = plist.parse(file.contents.toString())
  src_file['name'] = 'new_name' if src_file['name']?
  dest_file = plist.build(src_file)
  file.contents = new Buffer(dest_file)
))
.pipe(gulp.dest("./tmp")))

Checking if it actually works with diff -u test.plist tmp/test.plist

--- test.plist  2014-11-09 14:49:50.000000000 +0900
+++ tmp/test.plist  2014-11-09 14:53:38.000000000 +0900
@@ -3,6 +3,6 @@
 <plist version="1.0">
   <dict>
     <key>name</key>
-    <string>aaa</string>
+    <string>new_name</string>
   </dict>
-</plist>
+</plist>
\ No newline at end of file