Merge pull request #7976 from jvilk/fix_node_buffer

[node] Export Buffer and SlowBuffer from "buffer" module.
This commit is contained in:
Masahiro Wakame
2016-02-07 02:12:30 +09:00
2 changed files with 13 additions and 0 deletions

View File

@@ -16,6 +16,8 @@ import * as path from "path";
import * as readline from "readline";
import * as childProcess from "child_process";
import * as os from "os";
// Specifically test buffer module regression.
import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer";
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
@@ -169,6 +171,14 @@ function bufferTests() {
index = buffer.indexOf(23);
index = buffer.indexOf(buffer);
}
// Imported Buffer from buffer module works properly
{
let b = new ImportedBuffer('123');
b.writeUInt8(0, 6);
let sb = new ImportedSlowBuffer(43);
b.writeUInt8(0, 6);
}
}

3
node/node.d.ts vendored
View File

@@ -411,6 +411,9 @@ interface NodeBuffer {
************************************************/
declare module "buffer" {
export var INSPECT_MAX_BYTES: number;
var BuffType: typeof Buffer;
var SlowBuffType: typeof SlowBuffer;
export { BuffType as Buffer, SlowBuffType as SlowBuffer };
}
declare module "querystring" {