zh Kooboo Logo Documents

Utils

 

A collection of utility methods
 
Date
 
k.utils.date.formate(dateTime: Date, formate: string): string
k.utils.date.now
k.utils.date.utcNow
 
String
 
Some extension methods for strings
k.utils.string.remove(input: string, ValueToRemove: string): string
k.utils.string.removeHtml(input: string): string
k.utils.string.replace(input: string, oldValue: string, newValue: string): string
k.utils.string.sementicSubString(input: string, start: number, count: number): string
k.utils.string.subString(input: string, start: number, count: number): string
 
 
Compression
 
k.utils.compression.unzip(Binary: number[]): ZipItem[]
k.utils.compression.decompressGzip(path: string): string
 
Office
 
k.utils.office.excel.createNewWorkbook
k.utils.office.excel.getWorkBook
k.utils.office.excel.readAsObjects
k.utils.office.excel.readSheetNames
...
 
CDN
 
Notification mechanism of Kooboo's built-in CDN server
 
k.utils.CDN.disableCDN(): void
k.utils.CDN.enableCDN(): void
k.utils.CDN.setCacheTime(minutes: number): void
 
Template
 
Kooboo template render engine
 
 k.utils.template.render(view: string): string
 
Converter
 
k.utils.converter.htmlToPdf(htmlcode: string): number[] 
k.utils.converter.officeToHTML(officebytes: number[], filename: string): string
 
ClientJs
 
Sending backend objects as frontend scripts to the browser
var obj = {};
obj.firstname = "name";
obj.lastname = "lastname";
k.clientJS.setVariable("myname", obj);


k.utils.clientJS.monacoResource(callback: string): string
 
Image
 
k.utils.image.changeFormat(Binary: number[], NewExtension: string): number[]
k.utils.image.resize(image: number[], height: number, width: number): number[]
k.utils.image.getSize(Image: number[]):  SizeMeansurement
 
Screenshot
 
Taking screenshots of a remote website
 
k.utils.screenShot.take(absoluteUrl: string): number[]
k.utils.screenShot.takeFromHTML(HTMLCode: string, width: number, height: number, fullPage: boolean): number[]
k.utils.screenShot.takeLocalPageUrl(LocalPageRelitiveUrl: string, width: number, height: number, fullPage: boolean): number[]
k.utils.screenShot.takePage(PageName: string, width: number, height: number, fullPage: boolean): number[]
 
Network
 
k.utils.ping('www.kooboo.com');
k.utils.sshClient.passwordConnect(host: string, user: string, password: string, callback: (p1: KScript.Ssh.ConnectedClient) => void, timeout: number): void
k.utils.sshClient.privateKeyConnect(host: string, user: string, privateKey: string, callback: (p1: KScript.Ssh.ConnectedClient) => void, timeout: number): void

k.utils.sftpClient.passwordConnect();
k.utils.sftpClient.privateKeyConnect();