Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Formidable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import path from 'node:path';
import fsPromises from 'node:fs/promises';
import { EventEmitter } from 'node:events';
import { StringDecoder } from 'node:string_decoder';
import hexoid from 'hexoid';
import once from 'once';
import dezalgo from 'dezalgo';
import { hexoid } from './helpers/hexoid';
import { octetstream, querystring, multipart, json } from './plugins/index.js';
import PersistentFile from './PersistentFile.js';
import VolatileFile from './VolatileFile.js';
Expand Down
21 changes: 21 additions & 0 deletions src/helpers/hexoid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable */

// This file is a vendored copy of https://github.com/lukeed/hexoid at e956bef3d1efa5c0f27807df280db668d5c16e32
// Vendored due to compatibility issues with webpack and inconsistent exports between CommonJS and ESM modules
// See: https://github.com/lukeed/hexoid/issues/7 for more details

var IDX=256, HEX=[];
while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);

export function hexoid(len) {
len = len || 16;
var str='', num=0;
return function () {
if (!str || num === 256) {
str=''; num=(1+len)/2 | 0;
while (num--) str += HEX[256 * Math.random() | 0];
str = str.substring(num=0, len-2);
}
return str + HEX[num++];
};
}