Every line of 'req.files' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
125 function files(req, options, cb) { 126 var scope = this; 127 var log = this.log, recursive = this.recursive; 128 if(typeof options === 'function') { 129 next = options; 130 options = {}; 131 } 132 options = options || {}; 133 options.recursive = this.recursive; 134 var list = options.list || []; 135 options.all = typeof options.all === 'boolean' 136 ? options.all : false; 137 options.recursive = typeof this.recursive === 'boolean' 138 ? this.recursive : false; 139 options.warn = typeof options.warn === 'boolean' 140 ? options.warn : true; 141 options.require = typeof options.require === 'boolean' 142 ? options.require : true; 143 options.filter = options.filter 144 ? options.filter : filter; 145 146 async.concatSeries(list, function(item, callback) { 147 read.call(scope, req, options, item, callback); 148 }, function(err, results) { 149 if(err) return cb(err); 150 results = results.map(function(value) { 151 return value && typeof value === 'object' ? value : null; 152 }) 153 cb(null, results); 154 }) 155 }
246 mkFileReq() { 247 let putExtra = Object.assign( 248 { mimeType: "application/octet-stream" }, 249 this.putExtra 250 ); 251 252 let requestUrL = createMkFileUrl( 253 this.uploadUrl, 254 this.file, 255 this.key, 256 putExtra 257 ); 258 259 let body = this.ctxList.map(value => value.ctx).join(","); 260 let headers = getHeadersForMkFile(this.token); 261 let onCreate = this.xhrHandler; 262 let method = "POST"; 263 return request(requestUrL, { method, body, headers, onCreate}).then( 264 res => { 265 this.updateMkFileProgress(1); 266 return Promise.resolve(res); 267 } 268 ); 269 }
34 files(request) { 35 const document = request.document; 36 this.filesCollection.forEach(file => { 37 request.queueChild('file', `${request.url}/contents/${file}`, `urn:repo:${document.id}`); 38 }); 39 return null; 40 }