typed-struct icon indicating copy to clipboard operation
typed-struct copied to clipboard

Request: Allow opting into using https://github.com/feross/buffer to provide `Buffer` instead of Node's built-in `Buffer`

Open akalsi87 opened this issue 1 year ago • 1 comments

  • I'm submitting a ... [ ] bug report [x] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project [ ] documentation/syntax error report

  • Summary

I have a codegen tool that is converting XML into TypeScript where the struct definitions simply call new Struct()...compile(). This works perfectly for the case where my code is in a Node environment. However, it does not work as expected in the browser, and the reason is the use of Buffer. Now, there may be other dependencies, but I'm not concerned about iconv etc.

There is a buffer-compatible library here. I'm wondering if it would be feasible for you to allow replacing the Node Buffer class with the one exported from this library as an option.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

akalsi87 avatar Jul 08 '24 18:07 akalsi87

In the near future I will have free time and I will be able to deal with this issue. Good offer, thanks.

sarakusha avatar Jul 10 '24 04:07 sarakusha

the commit 7a7ea4dc8afe83454deab013dd104bbeb6a28253 solved the issue.

sarakusha avatar Aug 19 '24 14:08 sarakusha