init types for memorystream

This commit is contained in:
bangbang93
2019-01-11 10:06:09 +08:00
parent 70fe269343
commit 126b994508
4 changed files with 56 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for memorystream 0.3
// Project: https://github.com/JSBizon/node-memorystream
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Stream, Duplex } from "stream";
type DataType = string | Buffer | Stream;
interface IOptions {
readable: boolean;
writeable: boolean;
maxbufsize: number;
bufoverflow: number;
frequence: number;
}
declare class MemoryStream extends Duplex {
constructor(
data?: DataType | DataType[],
options?: IOptions,
);
}
export = MemoryStream;
+8
View File
@@ -0,0 +1,8 @@
import MemoryStream = require('memorystream');
import { createReadStream } from 'fs';
const ms = new MemoryStream();
createReadStream('index.ts').pipe(ms);
ms.pipe(process.stdout);
ms.write('it works');
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": ["node"],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"memorystream-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }