mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-31 07:08:40 -04:00
docs: consolidate docs (#2182)
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
8d46d7e39e
commit
ecffebc43c
307 changed files with 1474 additions and 487 deletions
src/components/common/download
|
@ -1,15 +1,22 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/**
|
||||
* Download a given {@link BlobPart file} from memory<.
|
||||
*
|
||||
* @param data The file to download.
|
||||
* @param fileName Which filename does the file have.
|
||||
* @param mimeType What is the files mimetype.
|
||||
*/
|
||||
export const download = (data: BlobPart, fileName: string, mimeType: string): void => {
|
||||
const file = new Blob([data], { type: mimeType })
|
||||
downloadLink(URL.createObjectURL(file), fileName)
|
||||
}
|
||||
|
||||
export const downloadLink = (url: string, fileName: string): void => {
|
||||
const downloadLink = (url: string, fileName: string): void => {
|
||||
const helperElement = document.createElement('a')
|
||||
helperElement.href = url
|
||||
helperElement.download = fileName
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue