feat: add file view (#1064)

This commit is contained in:
Aman Harwara
2022-06-06 21:30:51 +05:30
committed by GitHub
parent c20f0ad78b
commit 92024ec7ca
33 changed files with 661 additions and 382 deletions

View File

@@ -0,0 +1,18 @@
import { FileItem } from '@standardnotes/snjs'
import { MutableRefObject } from 'react'
export const createObjectURLWithRef = (
type: FileItem['mimeType'],
bytes: Uint8Array,
ref: MutableRefObject<string | undefined>,
) => {
const objectURL = URL.createObjectURL(
new Blob([bytes], {
type,
}),
)
ref.current = objectURL
return objectURL
}