storj/web/satellite/src/utils/download.ts
Vitalii c5bca894fd web/satellite: fix linter
Added imports linting, trailing commas, trailing semicolons, single quotes and spaces between curly braces.

Change-Id: I5de5d3eea48753dfe2737983b230bafaffe898c8
2022-09-09 11:02:04 +00:00

18 lines
552 B
TypeScript

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
/**
* DownloadTXT is used to download some content as a file.
*/
export class Download {
public static file(content: string, name: string): void {
const blob = new Blob([content], { type: 'text/plain' });
const elem = window.document.createElement('a');
elem.href = window.URL.createObjectURL(blob);
elem.download = name;
document.body.appendChild(elem);
elem.click();
document.body.removeChild(elem);
}
}