File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const bucket = new Bucket(
1717 imageBucket . namespace ,
1818 imageBucket . name ,
1919) ;
20- const index = new FileIndex ( imageBucket . index . file_path ) ;
20+ const index = new FileIndex ( imageBucket . index . filePath ) ;
2121const imageBucketService = new ImageBucketService ( bucket , index ) ;
2222
2323export const bucketModule = {
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export const appConfig = () => ({
4040 namespace : process . env . IMAGE_BUCKET_NAMESPACE || 'aaaaa' ,
4141 name : process . env . IMAGE_BUCKET_NAME || 'some-bucket-name' ,
4242 index : {
43- file_path : process . env . IMAGE_INDEX_FILE_PATH || './tmp/index.txt' ,
43+ filePath : process . env . IMAGE_INDEX_FILE_PATH || './tmp/index.txt' ,
4444 } ,
4545 } ,
4646 post : {
Original file line number Diff line number Diff line change 11import type { IIndex } from '@index/types' ;
2- import { createReadStream } from 'fs' ;
2+ import { createReadStream , appendFileSync } from 'fs' ;
33import { appendFile } from 'fs/promises' ;
44import split2 from 'split2' ;
55import { Transform } from 'stream' ;
66import { pipeline } from 'stream/promises' ;
77
88export class FileIndex implements IIndex {
9- constructor ( private filePath : string ) { }
9+ constructor ( private filePath : string ) {
10+ // Create file if it doesn't exist
11+ appendFileSync ( this . filePath , '' ) ;
12+ }
1013
1114 async get ( key : string ) : Promise < string | null > {
1215 let indexValue = null ;
You can’t perform that action at this time.
0 commit comments