-
-
Save quevon24/377fb016fca3fe49f9e9787210fcf5f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getThumbnail = (id, size = 300) => | |
`https://drive.google.com/thumbnail?id=${id}&sz=${size}`; | |
export const getIcon = (mimeType) => | |
`https://drive-thirdparty.googleusercontent.com/256/type/${mimeType}`; | |
export const getFile = (id) => `https://drive.google.com/uc?id=${id}`; | |
export const webViewerURL = (url) => | |
`https://docs.google.com/viewer?url=${url}`; | |
export const webViewerID = (id) => `https://drive.google.com/file/d/${id}/view`; | |
export const webPreviewerID = (id) => `https://drive.google.com/file/d/${id}/preview`; | |
export const copyDocument = ( | |
id, | |
copyComments = true, | |
includeResolvedCommentsOnCopy = true, | |
copyCollaborators = false, | |
userstoinvite | |
) => | |
`https://docs.google.com/document/d/${id}/copy?${new URLSearchParams({ | |
copyComments, | |
includeResolvedCommentsOnCopy, | |
copyCollaborators, | |
userstoinvite, | |
})}`; | |
const downloadFile = (id) => | |
`https://drive.google.com/uc?export=download&id=${id}`; | |
// formats: pdf, doc, txt, html, odt, epub | |
const downloadDoc = (id, format) => | |
`https://docs.google.com/document/d/${id}/export?format=${format}`; | |
// formats: pdf, pptx | |
const downloadSlides = (id, format) => | |
`https://docs.google.com/presentation/d/${id}/export/${format}`; | |
const downloadSlidesPage = (id, page) => | |
`https://docs.google.com/presentation/d/${id}/export/png?pageid=p${page}`; | |
// formats: pdf, xlsx, csv | |
const downloadSheet = (id, format) => | |
`https://docs.google.com/spreadsheets/d/${id}/export?format=${format}`; | |
// formats: pdf, svg, jpg | |
const downloadDrawing = (id, format) => | |
`https://docs.google.com/drawings/d/${id}/export/${format}`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment