[bert] support encode/decode using node Buffer objects