import * as https from "https" ; import { AppContext } from "@scramjet/types" ; import { IncomingMessage } from "http" ; const downloadFile = ( url ) : Promise < number | undefined > => { return new Promise ( ( resolve ) => { https . get ( url , ( response ) => { resolve ( response . statusCode ) ; } ) ; } ) ; } ; param this param _inputStream param file param interval returns { Promise < void > } export = async function ( this , _inputStream , file , interval ) { return new Promise ( resolve => { this . addStopHandler ( resolve ) ; setInterval ( async ( ) => { const statusCode = await downloadFile ( file ) ; const status = { statusCode , date : new Date ( ) . toISOString ( ) } ; this . emit ( "status" , status ) ; this . logger . log ( status ) ; } , interval * 1000 ) ; } ) ; } ;