-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The bl module has a file called `BufferList.js` that is the buffer list without node streams, the idea being you can use it in the browser without having to pull in a readable streams implementation, which has become more necessary since webpack 5 stopped bundling shims for node internals. The main `bl.js` exports a class that extends both the buffer list and the node Duplex stream. It also has named exports for `BufferListStream` (the same as the default export) and `BufferList` (the same as the class from `BufferList.js`). I've attempted to represent them here. TS doesn't have multiple inheritance so I'm not sure how to represent the `BufferListStream` class without duplicating the methods of `BufferList`.
- Loading branch information
1 parent
04657b2
commit f2e27e2
Showing
5 changed files
with
94 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Type definitions for BufferList v5.0 | ||
// Project: https://github.com/rvagg/bl | ||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds> | ||
// Francis Gulotta <https://github.com/reconbot> | ||
// Ben Allfree <https://github.com/benallfree> | ||
// Alex Potsides <https://github.com/achingbrain> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/// <reference types="node" /> | ||
|
||
declare class BufferList { | ||
constructor(initialData?: Buffer | Buffer[] | BufferList | BufferList[] | string); | ||
|
||
length: number; | ||
append(buffer: Buffer | Buffer[] | BufferList | BufferList[] | string): BufferList; | ||
get(index: number): number; | ||
slice(start?: number, end?: number): Buffer; | ||
shallowSlice(start?: number, end?: number): BufferList; | ||
copy(dest: Buffer, destStart?: number, srcStart?: number, srcEnd?: number): Buffer; | ||
duplicate(): BufferList; | ||
consume(bytes?: number): void; | ||
toString(encoding?: string, start?: number, end?: number): string; | ||
indexOf(value: string | number | Uint8Array | BufferList | Buffer, byteOffset?: number, encoding?: string): number; | ||
readDoubleBE(offset?: number): number; | ||
readDoubleLE(offset?: number): number; | ||
readFloatBE(offset?: number): number; | ||
readFloatLE(offset?: number): number; | ||
readInt32BE(offset?: number): number; | ||
readInt32LE(offset?: number): number; | ||
readUInt32BE(offset?: number): number; | ||
readUInt32LE(offset?: number): number; | ||
readInt16BE(offset?: number): number; | ||
readInt16LE(offset?: number): number; | ||
readUInt16BE(offset?: number): number; | ||
readUInt16LE(offset?: number): number; | ||
readInt8(offset: number): number; | ||
readUInt8(offset: number): number; | ||
} | ||
export = BufferList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters