MCPcopy Create free account
hub / github.com/pillarjs/multiparty / Form

Function Form

index.js:52–89  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

50
51util.inherits(Form, stream.Writable);
52function Form(options) {
53 var opts = options || {}
54 var self = this;
55 stream.Writable.call(self, { emitClose: false })
56
57 self.error = null;
58
59 self.autoFields = !!opts.autoFields
60 self.autoFiles = !!opts.autoFiles
61
62 self.maxFields = opts.maxFields || 1000
63 self.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024
64 self.maxFilesSize = opts.maxFilesSize || Infinity
65 self.uploadDir = opts.uploadDir || os.tmpdir()
66 self.encoding = opts.encoding || 'utf8'
67
68 self.bytesReceived = 0;
69 self.bytesExpected = null;
70
71 self.openedFiles = [];
72 self.totalFieldSize = 0;
73 self.totalFieldCount = 0;
74 self.totalFileSize = 0;
75 self.flushing = 0;
76
77 self.backpressure = false;
78 self.writeCbs = [];
79
80 self.emitQueue = [];
81
82 self.on('newListener', function(eventName) {
83 if (eventName === 'file') {
84 self.autoFiles = true;
85 } else if (eventName === 'field') {
86 self.autoFields = true;
87 }
88 });
89}
90
91Form.prototype.parse = function(req, cb) {
92 var called = false;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…