Skip to content

Commit 454461a

Browse files
authored
fix: buffer is not defined in browser (#128)
1 parent 3f7d51b commit 454461a

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* Protocol - protocol constants */
22
const protocol = module.exports
3+
const { Buffer } = require('buffer')
34

45
/* Command code => mnemonic */
56
protocol.types = {

generate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const writeToStream = require('./writeToStream')
22
const EventEmitter = require('events')
3+
const { Buffer } = require('buffer')
34

45
function generate (packet, opts) {
56
const stream = new Accumulator()

numbers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { Buffer } = require('buffer')
12
const max = 65536
23
const cache = {}
34

writeToStream.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const protocol = require('./constants')
2+
const { Buffer } = require('buffer')
23
const empty = Buffer.allocUnsafe(0)
34
const zeroBuf = Buffer.from([0])
45
const numbers = require('./numbers')

0 commit comments

Comments
 (0)