summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2023-11-18 12:24:39 +0100
committerGitHub <noreply@github.com>2023-11-18 12:24:39 +0100
commit2fcb3f949bbde7f5380acc68dc6b1f938dec12bc (patch)
tree035bd400b4057a744b29a0ebee96579bfbf429f6 /g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js
parent~ | g4f `v-0.1.8.5` (diff)
parentAdd AiChatOnline, ChatgptDemoAi, ChatgptNext Providers (diff)
downloadgpt4free-2fcb3f949bbde7f5380acc68dc6b1f938dec12bc.tar
gpt4free-2fcb3f949bbde7f5380acc68dc6b1f938dec12bc.tar.gz
gpt4free-2fcb3f949bbde7f5380acc68dc6b1f938dec12bc.tar.bz2
gpt4free-2fcb3f949bbde7f5380acc68dc6b1f938dec12bc.tar.lz
gpt4free-2fcb3f949bbde7f5380acc68dc6b1f938dec12bc.tar.xz
gpt4free-2fcb3f949bbde7f5380acc68dc6b1f938dec12bc.tar.zst
gpt4free-2fcb3f949bbde7f5380acc68dc6b1f938dec12bc.zip
Diffstat (limited to 'g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js')
-rw-r--r--g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js54
1 files changed, 0 insertions, 54 deletions
diff --git a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js b/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js
deleted file mode 100644
index 7917678c..00000000
--- a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/utils/Decoder.js
+++ /dev/null
@@ -1,54 +0,0 @@
-'use strict'
-
-const RE_PLUS = /\+/g
-
-const HEX = [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-]
-
-function Decoder () {
- this.buffer = undefined
-}
-Decoder.prototype.write = function (str) {
- // Replace '+' with ' ' before decoding
- str = str.replace(RE_PLUS, ' ')
- let res = ''
- let i = 0; let p = 0; const len = str.length
- for (; i < len; ++i) {
- if (this.buffer !== undefined) {
- if (!HEX[str.charCodeAt(i)]) {
- res += '%' + this.buffer
- this.buffer = undefined
- --i // retry character
- } else {
- this.buffer += str[i]
- ++p
- if (this.buffer.length === 2) {
- res += String.fromCharCode(parseInt(this.buffer, 16))
- this.buffer = undefined
- }
- }
- } else if (str[i] === '%') {
- if (i > p) {
- res += str.substring(p, i)
- p = i
- }
- this.buffer = ''
- ++p
- }
- }
- if (p < len && this.buffer === undefined) { res += str.substring(p) }
- return res
-}
-Decoder.prototype.reset = function () {
- this.buffer = undefined
-}
-
-module.exports = Decoder