Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for buffer configuration. #1257

Conversation

tinchoz49
Copy link
Contributor

@tinchoz49 tinchoz49 commented Jun 24, 2019

Hi everyone!

Description

This PR add support for configuring dynamically a Buffer util.

Similar to what you can do with the util.Long: https://github.com/protobufjs/protobuf.js#browserify-integration

protobuf.util.Buffer = Buffer;
protobuf.configure();

Background

There is a lot of Node.js modules that only works with the Node Buffer implementation but also we can use it in the browser thanks to the feross/buffer.

Many bundle tools like Webpack, Browserify and Parcel already includes a node built-in Buffer implementation and we can use it in protobufjs to encode/decode bytes in similar structures (Buffer) between Node and the browser.

@tinchoz49 tinchoz49 changed the title Added support for buffer configuration. Add support for buffer configuration. Jun 24, 2019
@tinchoz49 tinchoz49 force-pushed the tinchoz49-support-for-buffer-configuration branch from 681dc13 to 3dd409e Compare June 24, 2019 20:41
@alexander-fenster
Copy link
Contributor

@tinchoz49 Can you please fix the CI? Thanks!

@tinchoz49 tinchoz49 force-pushed the tinchoz49-support-for-buffer-configuration branch from 7d8b2aa to f4087ec Compare June 24, 2019 22:46
@tinchoz49
Copy link
Contributor Author

Fixed

@tinchoz49
Copy link
Contributor Author

Will fix: #1239

@dpaez
Copy link

dpaez commented Oct 7, 2019

Any update on this?

Great lib by the way!

jamiees2 added a commit to jamiees2/protobuf.js that referenced this pull request Oct 20, 2019
@richburdon
Copy link

@alexander-fenster we're depending currently on this fork -- is it likely to get merged soon?

Thanks very much.

@alexander-fenster alexander-fenster merged commit 5f2f62b into protobufjs:master Nov 21, 2019
@richburdon
Copy link

Folks any chance you can create a new npm release for this:

https://github.com/protobufjs/protobuf.js/releases

bcoe added a commit that referenced this pull request Mar 11, 2020
bcoe added a commit that referenced this pull request Mar 11, 2020
pgherveou pushed a commit to pgherveou/protobuf.js that referenced this pull request Mar 28, 2020
* Added support for buffer configuration.

* Fixed tests for node 4.

* Fixed deprecated Buffer methods.
taylorcode pushed a commit to taylorcode/protobuf.js that referenced this pull request Oct 16, 2020
* Added support for buffer configuration.

* Fixed tests for node 4.

* Fixed deprecated Buffer methods.
renawolford6 added a commit to renawolford6/protobuf-script-build-javascript that referenced this pull request Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants