Skip to content

Commit

Permalink
Add PipeOptions to pipe() typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrippling committed Apr 19, 2023
1 parent b990a79 commit 9d13de0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
3 changes: 2 additions & 1 deletion libs/filesystem/jswrap_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,8 @@ void jswrap_file_skip_or_seek(JsVar* parent, int nBytes, bool is_skip) {
"params" : [
["destination","JsVar","The destination file/stream that will receive content from the source."],
["options","JsVar",["[optional] An object `{ chunkSize : int=32, end : bool=true, complete : function }`","chunkSize : The amount of data to pipe from source to destination at a time","complete : a function to call when the pipe activity is complete","end : call the 'end' function on the destination when the source is finished"]]
]
],
"typescript": "pipe(destination: any, options?: PipeOptions): void"
}
Pipe this file to a stream (an object with a 'write' method)
*/
Expand Down
6 changes: 4 additions & 2 deletions libs/network/http/jswrap_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ Return a string containing characters that have been received
"params" : [
["destination","JsVar","The destination file/stream that will receive content from the source."],
["options","JsVar",["[optional] An object `{ chunkSize : int=32, end : bool=true, complete : function }`","chunkSize : The amount of data to pipe from source to destination at a time","complete : a function to call when the pipe activity is complete","end : call the 'end' function on the destination when the source is finished"]]
]
],
"typescript": "pipe(dest: any, options?: PipeOptions): void"
}
Pipe this to a stream (an object with a 'write' method)
*/
Expand Down Expand Up @@ -292,7 +293,8 @@ Return a string containing characters that have been received
"params" : [
["destination","JsVar","The destination file/stream that will receive content from the source."],
["options","JsVar",["[optional] An object `{ chunkSize : int=32, end : bool=true, complete : function }`","chunkSize : The amount of data to pipe from source to destination at a time","complete : a function to call when the pipe activity is complete","end : call the 'end' function on the destination when the source is finished"]]
]
],
"typescript": "pipe(destination: any, options?: PipeOptions): void"
}
Pipe this to a stream (an object with a 'write' method)
*/
Expand Down
3 changes: 2 additions & 1 deletion libs/network/jswrap_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ Return a string containing characters that have been received
"params" : [
["destination","JsVar","The destination file/stream that will receive content from the source."],
["options","JsVar",["[optional] An object `{ chunkSize : int=32, end : bool=true, complete : function }`","chunkSize : The amount of data to pipe from source to destination at a time","complete : a function to call when the pipe activity is complete","end : call the 'end' function on the destination when the source is finished"]]
]
],
"typescript": "pipe(destination: any, options?: PipeOptions): void"
}
Pipe this to a stream (an object with a 'write' method)
*/
Expand Down
2 changes: 1 addition & 1 deletion src/jswrap_espruino.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ their values.
["destination","JsVar","The destination file/stream that will receive content from the source."],
["options","JsVar",["[optional] An object `{ chunkSize : int=64, end : bool=true, complete : function }`","chunkSize : The amount of data to pipe from source to destination at a time","complete : a function to call when the pipe activity is complete","end : call the 'end' function on the destination when the source is finished"]]
],
"typescript" : "pipe(source: any, destination: any, options?: { chunkSize?: number, end?: boolean, complete?: () => void }): void"
"typescript" : "pipe(source: any, destination: any, options?: PipeOptions): void"
}*/

/*JSON{
Expand Down
11 changes: 10 additions & 1 deletion src/jswrap_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ static void jswrap_pipe_dst_close_listener(JsVar *destination) {
jswrap_pipe_close_listener(destination, "destination");
}

/*TYPESCRIPT
type PipeOptions = {
chunkSize?: number,
end?: boolean,
complete?: () => void,
};
*/

/*JSON{
"type" : "staticmethod",
"class" : "fs",
Expand All @@ -246,7 +254,8 @@ static void jswrap_pipe_dst_close_listener(JsVar *destination) {
["source","JsVar","The source file/stream that will send content."],
["destination","JsVar","The destination file/stream that will receive content from the source."],
["options","JsVar",["[optional] An object `{ chunkSize : int=64, end : bool=true, complete : function }`","chunkSize : The amount of data to pipe from source to destination at a time","complete : a function to call when the pipe activity is complete","end : call the 'end' function on the destination when the source is finished"]]
]
],
"typescript": "pipe(destination: any, options?: PipeOptions): void"
}*/
void jswrap_pipe(JsVar* source, JsVar* dest, JsVar* options) {
if (!source || !dest) return;
Expand Down
3 changes: 2 additions & 1 deletion src/jswrap_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@ Return a string containing characters that have been received
"params" : [
["destination","JsVar","The destination file/stream that will receive content from the source."],
["options","JsVar",["[optional] An object `{ chunkSize : int=32, end : bool=true, complete : function }`","chunkSize : The amount of data to pipe from source to destination at a time","complete : a function to call when the pipe activity is complete","end : call the 'end' function on the destination when the source is finished"]]
]
],
"typescript": "pipe(destination: any, options?: PipeOptions): void"
}
Pipe this USART to a stream (an object with a 'write' method)
*/
3 changes: 2 additions & 1 deletion src/jswrap_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ void jswrap_storagefile_erase(JsVar *f) {
"params" : [
["destination","JsVar","The destination file/stream that will receive content from the source."],
["options","JsVar",["[optional] An object `{ chunkSize : int=32, end : bool=true, complete : function }`","chunkSize : The amount of data to pipe from source to destination at a time","complete : a function to call when the pipe activity is complete","end : call the 'end' function on the destination when the source is finished"]]
]
],
"typescript": "pipe(destination: any, options?: PipeOptions): void"
}
Pipe this file to a stream (an object with a 'write' method)
*/

0 comments on commit 9d13de0

Please sign in to comment.