feat: download and preview files from local backups automatically, if a local backup is available (#2076)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ByteChunker, OnChunkCallback } from '@standardnotes/files'
|
||||
import { ByteChunker, OnChunkCallbackNoProgress } from '@standardnotes/files'
|
||||
import { FileSelectionResponse } from '../types'
|
||||
import { readFile as utilsReadFile } from '../utils'
|
||||
import { FileReaderInterface } from '../Interface/FileReader'
|
||||
@@ -39,7 +39,7 @@ function selectFiles(): Promise<File[]> {
|
||||
async function readFile(
|
||||
file: File,
|
||||
minimumChunkSize: number,
|
||||
onChunk: OnChunkCallback,
|
||||
onChunk: OnChunkCallbackNoProgress,
|
||||
): Promise<FileSelectionResponse> {
|
||||
const buffer = await utilsReadFile(file)
|
||||
const chunker = new ByteChunker(minimumChunkSize, onChunk)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { OnChunkCallback } from '@standardnotes/files'
|
||||
import { OnChunkCallbackNoProgress } from '@standardnotes/files'
|
||||
|
||||
import { FileSelectionResponse } from '../types'
|
||||
|
||||
export interface FileReaderInterface {
|
||||
selectFiles(): Promise<File[]>
|
||||
|
||||
readFile(file: File, minimumChunkSize: number, onChunk: OnChunkCallback): Promise<FileSelectionResponse>
|
||||
readFile(file: File, minimumChunkSize: number, onChunk: OnChunkCallbackNoProgress): Promise<FileSelectionResponse>
|
||||
|
||||
available(): boolean
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ByteChunker, OnChunkCallback } from '@standardnotes/files'
|
||||
import { ByteChunker, OnChunkCallbackNoProgress } from '@standardnotes/files'
|
||||
import { FileReaderInterface } from './../Interface/FileReader'
|
||||
import { FileSelectionResponse } from '../types'
|
||||
|
||||
@@ -39,7 +39,7 @@ async function selectFiles(): Promise<File[]> {
|
||||
async function readFile(
|
||||
file: File,
|
||||
minimumChunkSize: number,
|
||||
onChunk: OnChunkCallback,
|
||||
onChunk: OnChunkCallbackNoProgress,
|
||||
): Promise<FileSelectionResponse> {
|
||||
const byteChunker = new ByteChunker(minimumChunkSize, onChunk)
|
||||
const stream = file.stream() as unknown as ReadableStream
|
||||
|
||||
Reference in New Issue
Block a user