-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the purpose of DestroyableTransform? #43
Comments
Also keep in mind that this is also valid with through2: fs.createReadStream('ex.txt')
.pipe(thru(function (chunk, enc, callback) {
for (var i = 0; i < chunk.length; i++)
if (chunk[i] == 97)
chunk[i] = 122 // swap 'a' for 'z'
callback(null, chunk)
}))
.pipe(fs.createWriteStream('out.txt')) |
@juliangruber Thanks! (1) I see, but could you name some / any use cases of having your stream destroy itself? I don't want to add this feature until I can fully understand this point. (2) My through version also takes async operations into account via promises. If you return a promise it will handle it accordingly. |
|
@juliangruber Thanks! 😄 |
ghost
closed this as completed
Apr 23, 2015
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have implemented a
through2
-like transform stream function wrapper that uses a simpler interface thanthrough2
here.While in
through2
you doIn mine you could:
I find this syntax (not necessarily adding the custom
.map()
function to thechunk
object), but thereturn
style to pass data) simpler, but there is no notion of destroying anything in my implementation.through
version that accomodates for this syntax?The text was updated successfully, but these errors were encountered: