Managing the helpers

Inside the clientappservices folder, create a file named helpers.global.ts and update it as follows:

// SNIPP SNIPP
export const HELPER = {
getFileSize: function(bytes: number, decimals ? : number): string {
if (bytes == 0) return '0 Bytes';
var k = 1024,
dm = decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
}
// SNIPP SNIPP

As of now, we have one helper method, which converts bytes to human readable file sizes. Next, update clientappservicesglobal.constants.ts and add the following:

// SNIPP SNIPP
export const GLOBAL = {
// SNIPP
allowedImageExt: ['jpg', 'jpeg', 'gif', 'bmp', 'png']
}
// SNIPP SNIPP

That is it; these are all the changes needed to test out our Vision API integration with SmartExchange.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.182.66