diff --git a/extensions/git/src/encoding.ts b/extensions/git/src/encoding.ts
index 4396105567f..d2bb831f123 100644
--- a/extensions/git/src/encoding.ts
+++ b/extensions/git/src/encoding.ts
@@ -9,7 +9,7 @@ import * as jschardet from 'jschardet';
jschardet.Constants.MINIMUM_THRESHOLD = 0.2;
-function detectEncodingByBOM(buffer: NodeBuffer): string | null {
+function detectEncodingByBOM(buffer: Buffer): string | null {
if (!buffer || buffer.length < 2) {
return null;
}
diff --git a/extensions/git/src/typings/jschardet.d.ts b/extensions/git/src/typings/jschardet.d.ts
index 9c553b129eb..f252a47fd09 100644
--- a/extensions/git/src/typings/jschardet.d.ts
+++ b/extensions/git/src/typings/jschardet.d.ts
@@ -3,7 +3,7 @@ declare module 'jschardet' {
encoding: string,
confidence: number
}
- export function detect(buffer: NodeBuffer): IDetectedMap;
+ export function detect(buffer: Buffer): IDetectedMap;
export const Constants: {
MINIMUM_THRESHOLD: number,
diff --git a/extensions/php-language-features/src/features/validationProvider.ts b/extensions/php-language-features/src/features/validationProvider.ts
index d139fde1121..c3c513d3220 100644
--- a/extensions/php-language-features/src/features/validationProvider.ts
+++ b/extensions/php-language-features/src/features/validationProvider.ts
@@ -23,7 +23,7 @@ export class LineDecoder {
this.remaining = null;
}
- public write(buffer: NodeBuffer): string[] {
+ public write(buffer: Buffer): string[] {
var result: string[] = [];
var value = this.remaining
? this.remaining + this.stringDecoder.write(buffer)
diff --git a/src/typings/iconv-lite.d.ts b/src/typings/iconv-lite.d.ts
index 2b66468d456..0ed342db377 100644
--- a/src/typings/iconv-lite.d.ts
+++ b/src/typings/iconv-lite.d.ts
@@ -6,9 +6,9 @@
///
declare module 'iconv-lite' {
- export function decode(buffer: NodeBuffer, encoding: string): string;
+ export function decode(buffer: Buffer, encoding: string): string;
- export function encode(content: string | NodeBuffer, encoding: string, options?: { addBOM?: boolean }): NodeBuffer;
+ export function encode(content: string | Buffer, encoding: string, options?: { addBOM?: boolean }): Buffer;
export function encodingExists(encoding: string): boolean;
diff --git a/src/typings/jschardet.d.ts b/src/typings/jschardet.d.ts
index 9c553b129eb..f252a47fd09 100644
--- a/src/typings/jschardet.d.ts
+++ b/src/typings/jschardet.d.ts
@@ -3,7 +3,7 @@ declare module 'jschardet' {
encoding: string,
confidence: number
}
- export function detect(buffer: NodeBuffer): IDetectedMap;
+ export function detect(buffer: Buffer): IDetectedMap;
export const Constants: {
MINIMUM_THRESHOLD: number,
diff --git a/src/vs/base/node/crypto.ts b/src/vs/base/node/crypto.ts
index b658da126b6..4951a5dcc09 100644
--- a/src/vs/base/node/crypto.ts
+++ b/src/vs/base/node/crypto.ts
@@ -32,7 +32,7 @@ export function checksum(path: string, sha1hash: string): TPromise {
input.once('error', done);
input.once('end', done);
hashStream.once('error', done);
- hashStream.once('data', (data: NodeBuffer) => done(null, data.toString('hex')));
+ hashStream.once('data', (data: Buffer) => done(null, data.toString('hex')));
});
return promise.then(hash => {
diff --git a/src/vs/base/node/decoder.ts b/src/vs/base/node/decoder.ts
index de145fc29b2..9cfb1094995 100644
--- a/src/vs/base/node/decoder.ts
+++ b/src/vs/base/node/decoder.ts
@@ -25,7 +25,7 @@ export class LineDecoder {
this.remaining = null;
}
- public write(buffer: NodeBuffer): string[] {
+ public write(buffer: Buffer): string[] {
let result: string[] = [];
let value = this.remaining
? this.remaining + this.stringDecoder.write(buffer)
diff --git a/src/vs/base/node/encoding.ts b/src/vs/base/node/encoding.ts
index 2c68f89b6ba..f5dc3ab5ffa 100644
--- a/src/vs/base/node/encoding.ts
+++ b/src/vs/base/node/encoding.ts
@@ -119,11 +119,11 @@ export function bomLength(encoding: string): number {
return 0;
}
-export function decode(buffer: NodeBuffer, encoding: string): string {
+export function decode(buffer: Buffer, encoding: string): string {
return iconv.decode(buffer, toNodeEncoding(encoding));
}
-export function encode(content: string | NodeBuffer, encoding: string, options?: { addBOM?: boolean }): NodeBuffer {
+export function encode(content: string | Buffer, encoding: string, options?: { addBOM?: boolean }): Buffer {
return iconv.encode(content, toNodeEncoding(encoding), options);
}
@@ -147,7 +147,7 @@ function toNodeEncoding(enc: string): string {
return enc;
}
-export function detectEncodingByBOMFromBuffer(buffer: NodeBuffer, bytesRead: number): string {
+export function detectEncodingByBOMFromBuffer(buffer: Buffer, bytesRead: number): string {
if (!buffer || bytesRead < 2) {
return null;
}
@@ -193,7 +193,7 @@ const IGNORE_ENCODINGS = ['ascii', 'utf-8', 'utf-16', 'utf-32'];
/**
* Guesses the encoding from buffer.
*/
-export function guessEncodingByBuffer(buffer: NodeBuffer): TPromise {
+export function guessEncodingByBuffer(buffer: Buffer): TPromise {
return toWinJsPromise(import('jschardet')).then(jschardet => {
jschardet.Constants.MINIMUM_THRESHOLD = MINIMUM_THRESHOLD;
diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts
index 82e1cfd0fde..b52c4e36f0d 100644
--- a/src/vs/base/node/extfs.ts
+++ b/src/vs/base/node/extfs.ts
@@ -365,7 +365,7 @@ export interface IWriteFileOptions {
}
let canFlush = true;
-export function writeFileAndFlush(path: string, data: string | NodeBuffer | NodeJS.ReadableStream, options: IWriteFileOptions, callback: (error?: Error) => void): void {
+export function writeFileAndFlush(path: string, data: string | Buffer | NodeJS.ReadableStream, options: IWriteFileOptions, callback: (error?: Error) => void): void {
options = ensureOptions(options);
if (typeof data === 'string' || Buffer.isBuffer(data)) {
@@ -466,7 +466,7 @@ function doWriteFileStreamAndFlush(path: string, reader: NodeJS.ReadableStream,
// not in some cache.
//
// See https://github.com/nodejs/node/blob/v5.10.0/lib/fs.js#L1194
-function doWriteFileAndFlush(path: string, data: string | NodeBuffer, options: IWriteFileOptions, callback: (error?: Error) => void): void {
+function doWriteFileAndFlush(path: string, data: string | Buffer, options: IWriteFileOptions, callback: (error?: Error) => void): void {
if (options.encoding) {
data = encode(data, options.encoding.charset, { addBOM: options.encoding.addBOM });
}
@@ -503,7 +503,7 @@ function doWriteFileAndFlush(path: string, data: string | NodeBuffer, options: I
});
}
-export function writeFileAndFlushSync(path: string, data: string | NodeBuffer, options?: IWriteFileOptions): void {
+export function writeFileAndFlushSync(path: string, data: string | Buffer, options?: IWriteFileOptions): void {
options = ensureOptions(options);
if (options.encoding) {
diff --git a/src/vs/base/node/pfs.ts b/src/vs/base/node/pfs.ts
index 6172b9a30ad..5678be80081 100644
--- a/src/vs/base/node/pfs.ts
+++ b/src/vs/base/node/pfs.ts
@@ -98,7 +98,7 @@ export function readFile(path: string, encoding?: string): TPromise } = Object.create(null);
export function writeFile(path: string, data: string, options?: extfs.IWriteFileOptions): TPromise;
-export function writeFile(path: string, data: NodeBuffer, options?: extfs.IWriteFileOptions): TPromise;
+export function writeFile(path: string, data: Buffer, options?: extfs.IWriteFileOptions): TPromise;
export function writeFile(path: string, data: Uint8Array, options?: extfs.IWriteFileOptions): TPromise;
export function writeFile(path: string, data: NodeJS.ReadableStream, options?: extfs.IWriteFileOptions): TPromise;
export function writeFile(path: string, data: any, options?: extfs.IWriteFileOptions): TPromise {
diff --git a/src/vs/base/node/stream.ts b/src/vs/base/node/stream.ts
index a9ba27bb005..a1919336918 100644
--- a/src/vs/base/node/stream.ts
+++ b/src/vs/base/node/stream.ts
@@ -10,7 +10,7 @@ import * as fs from 'fs';
import { TPromise } from 'vs/base/common/winjs.base';
export interface ReadResult {
- buffer: NodeBuffer;
+ buffer: Buffer;
bytesRead: number;
}
@@ -24,7 +24,7 @@ export function readExactlyByFile(file: string, totalBytes: number): TPromise {
if (closeError) {
return error(closeError);
diff --git a/src/vs/workbench/services/files/node/watcher/win32/csharpWatcherService.ts b/src/vs/workbench/services/files/node/watcher/win32/csharpWatcherService.ts
index 8c18ce5b640..93dc71bd159 100644
--- a/src/vs/workbench/services/files/node/watcher/win32/csharpWatcherService.ts
+++ b/src/vs/workbench/services/files/node/watcher/win32/csharpWatcherService.ts
@@ -46,7 +46,7 @@ export class OutOfProcessWin32FolderWatcher {
const stdoutLineDecoder = new decoder.LineDecoder();
// Events over stdout
- this.handle.stdout.on('data', (data: NodeBuffer) => {
+ this.handle.stdout.on('data', (data: Buffer) => {
// Collect raw events from output
const rawEvents: IRawFileChange[] = [];
@@ -86,13 +86,13 @@ export class OutOfProcessWin32FolderWatcher {
// Errors
this.handle.on('error', (error: Error) => this.onError(error));
- this.handle.stderr.on('data', (data: NodeBuffer) => this.onError(data));
+ this.handle.stderr.on('data', (data: Buffer) => this.onError(data));
// Exit
this.handle.on('exit', (code: number, signal: string) => this.onExit(code, signal));
}
- private onError(error: Error | NodeBuffer): void {
+ private onError(error: Error | Buffer): void {
this.errorCallback('[FileWatcher] process error: ' + error.toString());
}
diff --git a/src/vs/workbench/services/search/node/worker/searchWorker.ts b/src/vs/workbench/services/search/node/worker/searchWorker.ts
index cdda1b2b257..d35999d4eda 100644
--- a/src/vs/workbench/services/search/node/worker/searchWorker.ts
+++ b/src/vs/workbench/services/search/node/worker/searchWorker.ts
@@ -177,8 +177,8 @@ export class SearchWorkerEngine {
return clb(null); // return early if canceled or limit reached
}
- fs.read(fd, buffer, 0, buffer.length, null, (error: Error, bytesRead: number, buffer: NodeBuffer) => {
- const decodeBuffer = (buffer: NodeBuffer, start: number, end: number): string => {
+ fs.read(fd, buffer, 0, buffer.length, null, (error: Error, bytesRead: number, buffer: Buffer) => {
+ const decodeBuffer = (buffer: Buffer, start: number, end: number): string => {
if (options.encoding === UTF8 || options.encoding === UTF8_with_bom) {
return buffer.toString(undefined, start, end); // much faster to use built in toString() when encoding is default
}