Skip to content

Commit

Permalink
Have overwriteEncoding be called
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Nov 15, 2018
1 parent 02c20ee commit 11c473d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vs/base/node/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const UTF16le = 'utf16le';
export interface IDecodeStreamOptions {
guessEncoding?: boolean;
minBytesRequiredForDetection?: number;
overwriteEncoding?(detectedEncoding: string): string;
overwriteEncoding?(detectedEncoding: string | null): string;
}

export function toDecodeStream(readable: Readable, options: IDecodeStreamOptions): Promise<{ detected: IDetectedEncodingResult, stream: NodeJS.ReadableStream }> {
Expand Down Expand Up @@ -78,7 +78,7 @@ export function toDecodeStream(readable: Readable, options: IDecodeStreamOptions
this._decodeStreamConstruction = Promise.resolve(detectEncodingFromBuffer({
buffer: Buffer.concat(this._buffer), bytesRead: this._bytesBuffered
}, options.guessEncoding)).then(detected => {
if (options.overwriteEncoding && detected.encoding) {
if (options.overwriteEncoding) {
detected.encoding = options.overwriteEncoding(detected.encoding);
}
this._decodeStream = decodeStream(detected.encoding);
Expand Down

0 comments on commit 11c473d

Please sign in to comment.