Lines Matching refs:encoding

23 // Implement an async ._write(chunk, encoding, cb), and it'll handle all
123 // encoding is 'binary' so we have to make this configurable.
152 // The callback that the user supplies to write(chunk, encoding, cb).
286 function _write(stream, chunk, encoding, cb) {
289 if (typeof encoding === 'function') {
290 cb = encoding;
291 encoding = state.defaultEncoding;
293 if (!encoding)
294 encoding = state.defaultEncoding;
295 else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding))
296 throw new ERR_UNKNOWN_ENCODING(encoding);
306 chunk = Buffer.from(chunk, encoding);
307 encoding = 'buffer';
310 encoding = 'buffer';
313 encoding = 'buffer';
333 return writeOrBuffer(stream, state, chunk, encoding, cb);
336 Writable.prototype.write = function(chunk, encoding, cb) {
337 return _write(this, chunk, encoding, cb) === true;
355 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
357 if (typeof encoding === 'string')
358 encoding = StringPrototypeToLowerCase(encoding);
359 if (!Buffer.isEncoding(encoding))
360 throw new ERR_UNKNOWN_ENCODING(encoding);
361 this._writableState.defaultEncoding = encoding;
368 function writeOrBuffer(stream, state, chunk, encoding, callback) {
380 state.buffered.push({ chunk, encoding, callback });
381 if (state.allBuffers && encoding !== 'buffer') {
392 stream._write(chunk, encoding, state.onwrite);
401 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
411 stream._write(chunk, encoding, state.onwrite);
569 const { chunk, encoding, callback } = buffered[i];
572 doWrite(stream, state, false, len, chunk, encoding, callback);
587 Writable.prototype._write = function(chunk, encoding, cb) {
589 this._writev([{ chunk, encoding }], cb);
597 Writable.prototype.end = function(chunk, encoding, cb) {
603 encoding = null;
604 } else if (typeof encoding === 'function') {
605 cb = encoding;
606 encoding = null;
612 const ret = _write(this, chunk, encoding);