Support node Buffers as well as JS Strings

Squashed and cleaned up version of #2