summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/npm/node_modules/@fastify/busboy/lib/main.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/main.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/main.js')
-rw-r--r--g4f/Provider/npm/node_modules/@fastify/busboy/lib/main.js85
1 files changed, 0 insertions, 85 deletions
diff --git a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/main.js b/g4f/Provider/npm/node_modules/@fastify/busboy/lib/main.js
deleted file mode 100644
index 8794bebf..00000000
--- a/g4f/Provider/npm/node_modules/@fastify/busboy/lib/main.js
+++ /dev/null
@@ -1,85 +0,0 @@
-'use strict'
-
-const WritableStream = require('node:stream').Writable
-const { inherits } = require('node:util')
-const Dicer = require('../deps/dicer/lib/Dicer')
-
-const MultipartParser = require('./types/multipart')
-const UrlencodedParser = require('./types/urlencoded')
-const parseParams = require('./utils/parseParams')
-
-function Busboy (opts) {
- if (!(this instanceof Busboy)) { return new Busboy(opts) }
-
- if (typeof opts !== 'object') {
- throw new TypeError('Busboy expected an options-Object.')
- }
- if (typeof opts.headers !== 'object') {
- throw new TypeError('Busboy expected an options-Object with headers-attribute.')
- }
- if (typeof opts.headers['content-type'] !== 'string') {
- throw new TypeError('Missing Content-Type-header.')
- }
-
- const {
- headers,
- ...streamOptions
- } = opts
-
- this.opts = {
- autoDestroy: false,
- ...streamOptions
- }
- WritableStream.call(this, this.opts)
-
- this._done = false
- this._parser = this.getParserByHeaders(headers)
- this._finished = false
-}
-inherits(Busboy, WritableStream)
-
-Busboy.prototype.emit = function (ev) {
- if (ev === 'finish') {
- if (!this._done) {
- this._parser?.end()
- return
- } else if (this._finished) {
- return
- }
- this._finished = true
- }
- WritableStream.prototype.emit.apply(this, arguments)
-}
-
-Busboy.prototype.getParserByHeaders = function (headers) {
- const parsed = parseParams(headers['content-type'])
-
- const cfg = {
- defCharset: this.opts.defCharset,
- fileHwm: this.opts.fileHwm,
- headers,
- highWaterMark: this.opts.highWaterMark,
- isPartAFile: this.opts.isPartAFile,
- limits: this.opts.limits,
- parsedConType: parsed,
- preservePath: this.opts.preservePath
- }
-
- if (MultipartParser.detect.test(parsed[0])) {
- return new MultipartParser(this, cfg)
- }
- if (UrlencodedParser.detect.test(parsed[0])) {
- return new UrlencodedParser(this, cfg)
- }
- throw new Error('Unsupported Content-Type.')
-}
-
-Busboy.prototype._write = function (chunk, encoding, cb) {
- this._parser.write(chunk, cb)
-}
-
-module.exports = Busboy
-module.exports.default = Busboy
-module.exports.Busboy = Busboy
-
-module.exports.Dicer = Dicer