Repository navigation
Commit 2d90739
authored
Avoid using deprecated Buffer constructor
Use Buffer.allocUnsafe directly on Node.js >= 4.5.0
This usecase doesn't need zero-filling, as is properly filled with the
parent buffer.
This behaves exactly the same as Buffer(number) on 4.x and 6.x,
and slightly faster that Buffer(number) on 8.x and above, as doesn't
perform zero-fill.
Older Node.js versions (<4.5.0) use the old code path.
Refs:
https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor1 parent a321fd8 commit 2d90739
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
0 commit comments