mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
[csv-stringify] Allow .write to write array with optional encoding and callback
This commit is contained in:
@@ -25,6 +25,9 @@ stringify([["1", true, new Date()], ["4", false, new Date()]], {
|
||||
stream = stringify({ delimiter: "," });
|
||||
|
||||
stream.write(["1", "2", "3"]);
|
||||
stream.write(["4", true, new Date()], 'utf8', (err: Error, output: string): void => {
|
||||
// nothing
|
||||
});
|
||||
|
||||
const transform: NodeJS.ReadWriteStream = stream;
|
||||
|
||||
|
||||
Vendored
+3
-4
@@ -69,12 +69,11 @@ declare namespace stringify {
|
||||
}
|
||||
|
||||
interface Stringifier extends NodeJS.ReadWriteStream {
|
||||
// Stringifier stream takes array of strings or Object
|
||||
write(line: string[] | any): boolean;
|
||||
// Stringifier stream takes array of strings or Object, and optional encoding and callback
|
||||
write(line: string[] | any, encoding?: string, cb?: (error: Error | undefined, output: string) => void): boolean;
|
||||
|
||||
// repeat declarations from NodeJS.WritableStream to avoid compile error
|
||||
write(buffer: string | Buffer, cb?: () => void): boolean;
|
||||
write(str: string, encoding?: string, cb?: () => void): boolean;
|
||||
write(buffer: string | Buffer, cb?: (error: Error | undefined, output: string) => void): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user