Skip to content

Commit

Permalink
Remove buffer imports
Browse files Browse the repository at this point in the history
  • Loading branch information
valadaptive committed Mar 30, 2024
1 parent 41108a7 commit bd70cce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
5 changes: 1 addition & 4 deletions etc/browser/avsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
*/

let containers = require('../../lib/containers'),
buffer = require('buffer'),
stream = require('stream');

let Buffer = buffer.Buffer;

/** Transform stream which lazily reads a blob's contents. */
class BlobReader extends stream.Readable {
constructor (blob, opts) {
Expand Down Expand Up @@ -40,7 +37,7 @@ class BlobReader extends stream.Readable {
if (evt.error) {
self.emit('error', evt.error);
} else {
self.push(Buffer.from(reader.result));
self.push(reader.result);
}
}, false);
reader.readAsArrayBuffer(blob);
Expand Down
8 changes: 3 additions & 5 deletions etc/browser/lib/md5.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*
*/

let buffer = require('buffer');
let Buffer = buffer.Buffer;

function md5cycle(x, k) {
let a = x[0], b = x[1], c = x[2], d = x[3];

Expand Down Expand Up @@ -148,9 +145,10 @@ function md5blk(s) {

function md5(s) {
let arr = md51(s);
let buf = Buffer.alloc(16);
let buf = new Uint8Array(16);
let dv = new DataView(buf.buffer);
for (let i = 0; i < 4; i++) {
buf.writeIntLE(arr[i], i * 4, 4);
dv.setInt32(i * 4, arr[i], true);
}
return buf;
}
Expand Down
3 changes: 0 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@

/** Various utilities used across this library. */

let buffer = require('buffer');
let platform = require('./platform');

let Buffer = buffer.Buffer;

// Valid (field, type, and symbol) name regex.
const NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;

Expand Down

0 comments on commit bd70cce

Please sign in to comment.