Skip to content

Commit

Permalink
Switched from fs.WriteStream to stream.Writable in order to provide m…
Browse files Browse the repository at this point in the history
…ore streaming flexibility (#207)
  • Loading branch information
gionkunz authored Jan 20, 2021
1 parent e1c844f commit 3a4028d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/node.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from "fs";
import stream from "stream";
import * as SwissQRBill_ from "./swissqrbill";


Expand All @@ -20,12 +21,12 @@ module SwissQRBill {
export class PDF extends SwissQRBill_.PDF {

constructor(data: data, outputPath: string, options?: options)
constructor(data: data, writeableStream: fs.WriteStream, options?: options)
constructor(data: data, writeableStream: stream.Writable, options?: options)
constructor(data: data, outputPath: string, options?: options, callback?: Function)
constructor(data: data, writeableStream: fs.WriteStream, options?: options, callback?: Function)
constructor(data: data, writeableStream: stream.Writable, options?: options, callback?: Function)
constructor(data: data, outputPath: string, callback?: Function)
constructor(data: data, writeableStream: fs.WriteStream, callback?: Function)
constructor(data: data, outputPathOrWriteableStream: string | fs.WriteStream, optionsOrCallback?: options | Function, callbackOrUndefined?: Function | undefined) {
constructor(data: data, writeableStream: stream.Writable, callback?: Function)
constructor(data: data, outputPathOrWriteableStream: string | stream.Writable, optionsOrCallback?: options | Function, callbackOrUndefined?: Function | undefined) {

let callback: Function | undefined = undefined;
let options: options | undefined = undefined;
Expand All @@ -44,7 +45,7 @@ module SwissQRBill {

super(data, options);

let stream: fs.WriteStream | undefined;
let stream: stream.Writable | undefined;

if(typeof outputPathOrWriteableStream === "string"){
stream = fs.createWriteStream(outputPathOrWriteableStream);
Expand Down

0 comments on commit 3a4028d

Please sign in to comment.