atom / node-pathwatcher

Path Watcher Node Module
http://atom.github.io/node-pathwatcher
MIT License
93 stars 47 forks source link

Feature file stream #100

Closed abe33 closed 8 years ago

abe33 commented 8 years ago

The File::read method is already using a stream to process the file's content with iconv on the fly, but there's no way for the consumer of a File to get a read stream for the proper encoding - one can always use the fs APIs to get a stream but it has to include iconv-lite as dependency if it want to behave the same as the File API.

This PR adds a public createReadStream method on the File object that encapsulates the stream creation that was previously in the read method.

lee-dohm commented 8 years ago

Looks great to me! /cc @atom/feedback for extra :eyes:

abe33 commented 8 years ago

I'm wondering if I should also add a write stream method as well to be consistent. The returned write stream would be an iconv-lite encode stream using the current file's encoding.

lee-dohm commented 8 years ago

Sounds like a good idea to me :grinning:

abe33 commented 8 years ago

ping @atom/feedback Any feedback on this?

lee-dohm commented 8 years ago

@abe33 Just to update you, we're leaning towards merging this. We just want to have @zcbenz take a look before we give the final go-ahead :grinning:

zcbenz commented 8 years ago

Looks good to me. :+1:

lee-dohm commented 8 years ago

Thanks @zcbenz!

abe33 commented 8 years ago

Thank you @zcbenz!