Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
uploadTask(path, file, meta, uploadType) {
const nameHash = Md5.hashStr(file.name + new Date().getTime());
const fileExt = file.type.split('/')[1];
const name = `${nameHash}.${fileExt}`;
const newMeta = {
...meta,
someMoreData: 'Moooore data'
};
const ref = this.storage.ref(`${path}/${name}`);
const task = ref.put(file, { customMetadata: newMeta });
// add the following lines
task.snapshotChanges().pipe(
finalize(() => {
this.downloadURL = ref.getDownloadURL();
console.log('Image Uploaded!');
async getAvatar(email: string): Promise {
const hash = Md5.hashStr(email);
return `https://www.gravatar.com/avatar/${hash}?d=robohash`;
}
}
export function generateWMTSIdFromSourceOptions(options: WMTSDataSourceOptions) {
const layer = options.layer;
const chain = 'wmts' + options.url + layer;
return Md5.hashStr(chain) as string;
}
protected getMessageId(m: PlainMessage): string {
return String(Md5.hashStr(`[${m.type}] ${m.text} : ${(m.actions || []).join(' | ')};`));
}
export function generateWMSIdFromSourceOptions(options: WMSDataSourceOptions) {
const layers = options.params.LAYERS;
const url = options.url.charAt(0) === '/' ? window.location.origin + options.url : options.url;
const chain = 'wms' + url + layers;
return Md5.hashStr(chain) as string;
}
protected generateId() {
if (!this.options.url) {
return uuid();
}
const chain = 'feature' + this.options.url;
return Md5.hashStr(chain) as string;
}
protected generateId() {
if (!this.options.url) {
return uuid();
}
const chain = 'mvt' + this.options.url;
return Md5.hashStr(chain) as string;
}
export function generateFeatureIdFromSourceOptions(options: WMTSDataSourceOptions) {
if (! options.url) { return generateId(options); }
const chain = 'feature' + options.url;
return Md5.hashStr(chain) as string;
}
function updateWebviewContent(panel: WebviewPanel, on_disk_files: [string, Uri]) {
const activeEditor = window.activeTextEditor;
if (!activeEditor) {
return;
}
const graph_name = Md5.hashStr(activeEditor.document.uri.toString()) + ".json"
const data_uri = path.join(preview_scratch_directory, graph_name);
var graph_data = JSON.parse(fs.readFileSync(data_uri, "utf8"));
panel.webview.html = `
<title>Benten: ${activeEditor.document.uri.toString()}</title>
<style type="text/css">
</style>
protected generateId() {
const layer = this.options.layer;
const chain = 'wmts' + this.options.url + layer;
return Md5.hashStr(chain) as string;
}