@@ -8,26 +8,23 @@ const MockDirMimeType = "directory";
88const MockDirMode = 0o040755 ;
99const MockFileMode = 0o100644 ;
1010const MockDirectoryChunkSize = 128 ;
11- const MockFileChunkSize = 64 * 1024 ;
1211const MockBaseModTime = Date . parse ( "2026-03-10T09:00:00.000Z" ) ;
1312const TinyPngBytes = Uint8Array . from ( [
14- 0x89 , 0x50 , 0x4e , 0x47 , 0x0d , 0x0a , 0x1a , 0x0a , 0x00 , 0x00 , 0x00 , 0x0d , 0x49 , 0x48 , 0x44 , 0x52 ,
15- 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x01 , 0x08 , 0x04 , 0x00 , 0x00 , 0x00 , 0xb5 , 0x1c , 0x0c ,
16- 0x02 , 0x00 , 0x00 , 0x00 , 0x0b , 0x49 , 0x44 , 0x41 , 0x54 , 0x78 , 0xda , 0x63 , 0xfc , 0xff , 0x1f , 0x00 ,
17- 0x03 , 0x03 , 0x01 , 0xff , 0xa5 , 0xf8 , 0x8f , 0xb1 , 0x00 , 0x00 , 0x00 , 0x00 , 0x49 , 0x45 , 0x4e , 0x44 ,
18- 0xae , 0x42 , 0x60 , 0x82 ,
13+ 0x89 , 0x50 , 0x4e , 0x47 , 0x0d , 0x0a , 0x1a , 0x0a , 0x00 , 0x00 , 0x00 , 0x0d , 0x49 , 0x48 , 0x44 , 0x52 , 0x00 , 0x00 , 0x00 ,
14+ 0x01 , 0x00 , 0x00 , 0x00 , 0x01 , 0x08 , 0x04 , 0x00 , 0x00 , 0x00 , 0xb5 , 0x1c , 0x0c , 0x02 , 0x00 , 0x00 , 0x00 , 0x0b , 0x49 ,
15+ 0x44 , 0x41 , 0x54 , 0x78 , 0xda , 0x63 , 0xfc , 0xff , 0x1f , 0x00 , 0x03 , 0x03 , 0x01 , 0xff , 0xa5 , 0xf8 , 0x8f , 0xb1 , 0x00 ,
16+ 0x00 , 0x00 , 0x00 , 0x49 , 0x45 , 0x4e , 0x44 , 0xae , 0x42 , 0x60 , 0x82 ,
1917] ) ;
2018const TinyJpegBytes = Uint8Array . from ( [
21- 0xff , 0xd8 , 0xff , 0xe0 , 0x00 , 0x10 , 0x4a , 0x46 , 0x49 , 0x46 , 0x00 , 0x01 , 0x01 , 0x00 , 0x00 , 0x01 ,
22- 0x00 , 0x01 , 0x00 , 0x00 , 0xff , 0xdb , 0x00 , 0x43 , 0x00 , 0x03 , 0x02 , 0x02 , 0x03 , 0x02 , 0x02 , 0x03 ,
23- 0x03 , 0x03 , 0x03 , 0x04 , 0x03 , 0x03 , 0x04 , 0x05 , 0x08 , 0x05 , 0x05 , 0x04 , 0x04 , 0x05 , 0x0a , 0x07 ,
24- 0x07 , 0x06 , 0x08 , 0x0c , 0x0a , 0x0c , 0x0c , 0x0b , 0x0a , 0x0b , 0x0b , 0x0d , 0x0e , 0x12 , 0x10 , 0x0d ,
25- 0x0e , 0x11 , 0x0e , 0x0b , 0x0b , 0x10 , 0x16 , 0x10 , 0x11 , 0x13 , 0x14 , 0x15 , 0x15 , 0x15 , 0x0c , 0x0f ,
26- 0x17 , 0x18 , 0x16 , 0x14 , 0x18 , 0x12 , 0x14 , 0x15 , 0x14 , 0xff , 0xc0 , 0x00 , 0x0b , 0x08 , 0x00 , 0x01 ,
27- 0x00 , 0x01 , 0x01 , 0x01 , 0x11 , 0x00 , 0xff , 0xc4 , 0x00 , 0x14 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 ,
28- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x08 , 0xff , 0xc4 , 0x00 , 0x14 ,
29- 0x10 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
30- 0x00 , 0x00 , 0xff , 0xda , 0x00 , 0x08 , 0x01 , 0x01 , 0x00 , 0x00 , 0x3f , 0x00 , 0xbf , 0xff , 0xd9 ,
19+ 0xff , 0xd8 , 0xff , 0xe0 , 0x00 , 0x10 , 0x4a , 0x46 , 0x49 , 0x46 , 0x00 , 0x01 , 0x01 , 0x00 , 0x00 , 0x01 , 0x00 , 0x01 , 0x00 ,
20+ 0x00 , 0xff , 0xdb , 0x00 , 0x43 , 0x00 , 0x03 , 0x02 , 0x02 , 0x03 , 0x02 , 0x02 , 0x03 , 0x03 , 0x03 , 0x03 , 0x04 , 0x03 , 0x03 ,
21+ 0x04 , 0x05 , 0x08 , 0x05 , 0x05 , 0x04 , 0x04 , 0x05 , 0x0a , 0x07 , 0x07 , 0x06 , 0x08 , 0x0c , 0x0a , 0x0c , 0x0c , 0x0b , 0x0a ,
22+ 0x0b , 0x0b , 0x0d , 0x0e , 0x12 , 0x10 , 0x0d , 0x0e , 0x11 , 0x0e , 0x0b , 0x0b , 0x10 , 0x16 , 0x10 , 0x11 , 0x13 , 0x14 , 0x15 ,
23+ 0x15 , 0x15 , 0x0c , 0x0f , 0x17 , 0x18 , 0x16 , 0x14 , 0x18 , 0x12 , 0x14 , 0x15 , 0x14 , 0xff , 0xc0 , 0x00 , 0x0b , 0x08 , 0x00 ,
24+ 0x01 , 0x00 , 0x01 , 0x01 , 0x01 , 0x11 , 0x00 , 0xff , 0xc4 , 0x00 , 0x14 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
25+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x08 , 0xff , 0xc4 , 0x00 , 0x14 , 0x10 , 0x01 , 0x00 , 0x00 , 0x00 ,
26+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xff , 0xda , 0x00 , 0x08 , 0x01 , 0x01 ,
27+ 0x00 , 0x00 , 0x3f , 0x00 , 0xbf , 0xff , 0xd9 ,
3128] ) ;
3229
3330type MockFsEntry = {
@@ -61,7 +58,6 @@ export type MockFilesystem = {
6158 fileRead : ( data : FileData ) => Promise < FileData > ;
6259 fileList : ( data : FileListData ) => Promise < FileInfo [ ] > ;
6360 fileJoin : ( paths : string [ ] ) => Promise < FileInfo > ;
64- fileReadStream : ( data : FileData ) => AsyncGenerator < FileData , void , boolean > ;
6561 fileListStream : ( data : FileListData ) => AsyncGenerator < CommandRemoteListEntriesRtnData , void , boolean > ;
6662} ;
6763
@@ -492,33 +488,9 @@ export function makeMockFilesystem(): MockFilesystem {
492488 }
493489 return toFileInfo ( entry ) ;
494490 } ;
495- const fileReadStream = async function * ( data : FileData ) : AsyncGenerator < FileData , void , boolean > {
496- const info = await fileInfo ( data ) ;
497- yield { info } ;
498- if ( info . notfound ) {
499- return ;
500- }
501- const entry = getEntry ( info . path ) ;
502- if ( entry . isdir ) {
503- const dirEntries = ( childrenByDir . get ( entry . path ) ?? [ ] ) . map ( ( child ) => toFileInfo ( child ) ) ;
504- for ( let idx = 0 ; idx < dirEntries . length ; idx += MockDirectoryChunkSize ) {
505- yield { entries : dirEntries . slice ( idx , idx + MockDirectoryChunkSize ) } ;
506- }
507- return ;
508- }
509- if ( entry . content == null || entry . content . byteLength === 0 ) {
510- return ;
511- }
512- const { offset, end } = getReadRange ( data , entry . content . byteLength ) ;
513- for ( let currentOffset = offset ; currentOffset < end ; currentOffset += MockFileChunkSize ) {
514- const chunkEnd = Math . min ( currentOffset + MockFileChunkSize , end ) ;
515- yield {
516- data64 : arrayToBase64 ( entry . content . slice ( currentOffset , chunkEnd ) ) ,
517- at : { offset : currentOffset , size : chunkEnd - currentOffset } ,
518- } ;
519- }
520- } ;
521- const fileListStream = async function * ( data : FileListData ) : AsyncGenerator < CommandRemoteListEntriesRtnData , void , boolean > {
491+ const fileListStream = async function * (
492+ data : FileListData
493+ ) : AsyncGenerator < CommandRemoteListEntriesRtnData , void , boolean > {
522494 const fileInfos = await fileList ( data ) ;
523495 for ( let idx = 0 ; idx < fileInfos . length ; idx += MockDirectoryChunkSize ) {
524496 yield { fileinfo : fileInfos . slice ( idx , idx + MockDirectoryChunkSize ) } ;
@@ -535,7 +507,6 @@ export function makeMockFilesystem(): MockFilesystem {
535507 fileRead,
536508 fileList,
537509 fileJoin,
538- fileReadStream,
539510 fileListStream,
540511 } ;
541512}
0 commit comments