Skip to content

Commit b57003f

Browse files
author
Benjamin Pasero
committed
NodeBuffer => Buffer
1 parent e2b722d commit b57003f

13 files changed

Lines changed: 23 additions & 23 deletions

File tree

extensions/git/src/encoding.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as jschardet from 'jschardet';
99

1010
jschardet.Constants.MINIMUM_THRESHOLD = 0.2;
1111

12-
function detectEncodingByBOM(buffer: NodeBuffer): string | null {
12+
function detectEncodingByBOM(buffer: Buffer): string | null {
1313
if (!buffer || buffer.length < 2) {
1414
return null;
1515
}

extensions/git/src/typings/jschardet.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ declare module 'jschardet' {
33
encoding: string,
44
confidence: number
55
}
6-
export function detect(buffer: NodeBuffer): IDetectedMap;
6+
export function detect(buffer: Buffer): IDetectedMap;
77

88
export const Constants: {
99
MINIMUM_THRESHOLD: number,

extensions/php-language-features/src/features/validationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class LineDecoder {
2323
this.remaining = null;
2424
}
2525

26-
public write(buffer: NodeBuffer): string[] {
26+
public write(buffer: Buffer): string[] {
2727
var result: string[] = [];
2828
var value = this.remaining
2929
? this.remaining + this.stringDecoder.write(buffer)

src/typings/iconv-lite.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
/// <reference path='./node.d.ts'/>
77

88
declare module 'iconv-lite' {
9-
export function decode(buffer: NodeBuffer, encoding: string): string;
9+
export function decode(buffer: Buffer, encoding: string): string;
1010

11-
export function encode(content: string | NodeBuffer, encoding: string, options?: { addBOM?: boolean }): NodeBuffer;
11+
export function encode(content: string | Buffer, encoding: string, options?: { addBOM?: boolean }): Buffer;
1212

1313
export function encodingExists(encoding: string): boolean;
1414

src/typings/jschardet.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ declare module 'jschardet' {
33
encoding: string,
44
confidence: number
55
}
6-
export function detect(buffer: NodeBuffer): IDetectedMap;
6+
export function detect(buffer: Buffer): IDetectedMap;
77

88
export const Constants: {
99
MINIMUM_THRESHOLD: number,

src/vs/base/node/crypto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function checksum(path: string, sha1hash: string): TPromise<void> {
3232
input.once('error', done);
3333
input.once('end', done);
3434
hashStream.once('error', done);
35-
hashStream.once('data', (data: NodeBuffer) => done(null, data.toString('hex')));
35+
hashStream.once('data', (data: Buffer) => done(null, data.toString('hex')));
3636
});
3737

3838
return promise.then(hash => {

src/vs/base/node/decoder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class LineDecoder {
2525
this.remaining = null;
2626
}
2727

28-
public write(buffer: NodeBuffer): string[] {
28+
public write(buffer: Buffer): string[] {
2929
let result: string[] = [];
3030
let value = this.remaining
3131
? this.remaining + this.stringDecoder.write(buffer)

src/vs/base/node/encoding.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ export function bomLength(encoding: string): number {
119119
return 0;
120120
}
121121

122-
export function decode(buffer: NodeBuffer, encoding: string): string {
122+
export function decode(buffer: Buffer, encoding: string): string {
123123
return iconv.decode(buffer, toNodeEncoding(encoding));
124124
}
125125

126-
export function encode(content: string | NodeBuffer, encoding: string, options?: { addBOM?: boolean }): NodeBuffer {
126+
export function encode(content: string | Buffer, encoding: string, options?: { addBOM?: boolean }): Buffer {
127127
return iconv.encode(content, toNodeEncoding(encoding), options);
128128
}
129129

@@ -147,7 +147,7 @@ function toNodeEncoding(enc: string): string {
147147
return enc;
148148
}
149149

150-
export function detectEncodingByBOMFromBuffer(buffer: NodeBuffer, bytesRead: number): string {
150+
export function detectEncodingByBOMFromBuffer(buffer: Buffer, bytesRead: number): string {
151151
if (!buffer || bytesRead < 2) {
152152
return null;
153153
}
@@ -193,7 +193,7 @@ const IGNORE_ENCODINGS = ['ascii', 'utf-8', 'utf-16', 'utf-32'];
193193
/**
194194
* Guesses the encoding from buffer.
195195
*/
196-
export function guessEncodingByBuffer(buffer: NodeBuffer): TPromise<string> {
196+
export function guessEncodingByBuffer(buffer: Buffer): TPromise<string> {
197197
return toWinJsPromise(import('jschardet')).then(jschardet => {
198198
jschardet.Constants.MINIMUM_THRESHOLD = MINIMUM_THRESHOLD;
199199

src/vs/base/node/extfs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export interface IWriteFileOptions {
365365
}
366366

367367
let canFlush = true;
368-
export function writeFileAndFlush(path: string, data: string | NodeBuffer | NodeJS.ReadableStream, options: IWriteFileOptions, callback: (error?: Error) => void): void {
368+
export function writeFileAndFlush(path: string, data: string | Buffer | NodeJS.ReadableStream, options: IWriteFileOptions, callback: (error?: Error) => void): void {
369369
options = ensureOptions(options);
370370

371371
if (typeof data === 'string' || Buffer.isBuffer(data)) {
@@ -466,7 +466,7 @@ function doWriteFileStreamAndFlush(path: string, reader: NodeJS.ReadableStream,
466466
// not in some cache.
467467
//
468468
// See https://github.com/nodejs/node/blob/v5.10.0/lib/fs.js#L1194
469-
function doWriteFileAndFlush(path: string, data: string | NodeBuffer, options: IWriteFileOptions, callback: (error?: Error) => void): void {
469+
function doWriteFileAndFlush(path: string, data: string | Buffer, options: IWriteFileOptions, callback: (error?: Error) => void): void {
470470
if (options.encoding) {
471471
data = encode(data, options.encoding.charset, { addBOM: options.encoding.addBOM });
472472
}
@@ -503,7 +503,7 @@ function doWriteFileAndFlush(path: string, data: string | NodeBuffer, options: I
503503
});
504504
}
505505

506-
export function writeFileAndFlushSync(path: string, data: string | NodeBuffer, options?: IWriteFileOptions): void {
506+
export function writeFileAndFlushSync(path: string, data: string | Buffer, options?: IWriteFileOptions): void {
507507
options = ensureOptions(options);
508508

509509
if (options.encoding) {

src/vs/base/node/pfs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function readFile(path: string, encoding?: string): TPromise<Buffer | str
9898
const writeFilePathQueue: { [path: string]: Queue<void> } = Object.create(null);
9999

100100
export function writeFile(path: string, data: string, options?: extfs.IWriteFileOptions): TPromise<void>;
101-
export function writeFile(path: string, data: NodeBuffer, options?: extfs.IWriteFileOptions): TPromise<void>;
101+
export function writeFile(path: string, data: Buffer, options?: extfs.IWriteFileOptions): TPromise<void>;
102102
export function writeFile(path: string, data: Uint8Array, options?: extfs.IWriteFileOptions): TPromise<void>;
103103
export function writeFile(path: string, data: NodeJS.ReadableStream, options?: extfs.IWriteFileOptions): TPromise<void>;
104104
export function writeFile(path: string, data: any, options?: extfs.IWriteFileOptions): TPromise<void> {

0 commit comments

Comments
 (0)