ashtuchkin / iconv-lite

Convert character encodings in pure javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Version w/Uint8Array option?

benrr101 opened this issue · comments

I see in the master branch, the typings file allows for Buffer|Uint8Array. I'm currently working on refactoring some of the text decoding code in my project and would love to be able to use a Uint8Array with iconv-lite. Any chance we can get that change published? 😄

Hey Ben, do you need that for encoding or decoding? Current published version will happily decode Uint8Array even though the typings are not there. Publishing current master is tricky as it's not done yet.

Thanks for the response! I need it for decoding, so it's good to know that it will take Uint8Array even if the typings aren't there yet. I wanted to avoid the additional allocation of doing Buffer.from(myUint8Array). I'll give it a shot with an unsafe 'cast' in typescript and put a note in my code to remove the unsafe action once the new version is out.