5 examples of 'writehead' in JavaScript

Every line of 'writehead' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
225ReaddirCall.prototype.writeHead = function writeHead() {
226 var xdr = this._serialize(XDR.byteLength(this.dir) + 20);
227 xdr.writeString(this.dir);
228 xdr.writeHyper(this.cookie);
229 if (!this.cookieverf) {
230 this.cookieverf = new Buffer(8);
231 this.cookieverf.fill(0);
232 }
233 xdr.writeRaw(this.cookieverf);
234 xdr.writeInt(this.count);
235
236 this.write(xdr.buffer());
237};
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

258writeHead(statusCode, reason, obj) {
259 super.writeHead(statusCode, reason, obj);
260 // we want this._body to be just the body on this.end
261 this._header = '';
262}
39return function writeHead(statusCode) {
40 // set headers from arguments
41 var args = setWriteHeadHeaders.apply(this, arguments);
42
43 // fire listener
44 if (!fired) {
45 fired = true
46 listener.call(this)
47
48 // pass-along an updated status code
49 if (typeof args[0] === 'number' && this.statusCode !== args[0]) {
50 args[0] = this.statusCode
51 args.length = 1
52 }
53 }
54
55 prevWriteHead.apply(this, args);
56}
316writeHead(statusCode, statusMessage, headers) {
317 if (this.headersSent)
318 return;
319
320 if (!headers && typeof statusMessage !== 'string') {
321 headers = statusMessage;
322 statusMessage = undefined;
323 }
324 if (statusCode)
325 this.statusCode = statusCode;
326 if (statusMessage)
327 this.statusMessage = statusMessage;
328
329 if (headers) {
330 for (let name in headers)
331 this.setHeader(name, headers[name]);
332 }
333}
242AccessReply.prototype.writeHead = function writeHead() {
243 var len = 8;
244 if (this.obj_attributes)
245 len += fattr3.XDR_SIZE;
246 if (this.status === 0)
247 len += 4;
248
249 var xdr = this._serialize(len);
250
251 xdr.writeInt(this.status);
252 if (this.obj_attributes) {
253 xdr.writeBool(true);
254 fattr3.serialize(xdr, this.obj_attributes);
255 } else {
256 xdr.writeBool(false);
257 }
258
259 if (this.status === 0)
260 xdr.writeInt(this.access);
261
262 this.write(xdr.buffer());
263};

Related snippets