@@ -38,7 +38,8 @@ export class LocalDriver implements DriverContract {
3838
3939 const file = new File ( this . concat ( filePath ) , content )
4040
41- if ( file . originalFileExists ) throw new InternalServerException ( `File ${ filePath } already exists` )
41+ if ( file . originalFileExists )
42+ throw new InternalServerException ( `File ${ filePath } already exists` )
4243
4344 await file . create ( )
4445 }
@@ -87,7 +88,8 @@ export class LocalDriver implements DriverContract {
8788 async get ( filePath : string ) : Promise < Buffer > {
8889 const file = new File ( this . concat ( filePath ) )
8990
90- if ( ! file . originalFileExists ) throw new InternalServerException ( `File ${ filePath } does not exist` )
91+ if ( ! file . originalFileExists )
92+ throw new InternalServerException ( `File ${ filePath } does not exist` )
9193
9294 return file . getContent ( )
9395 }
@@ -100,7 +102,8 @@ export class LocalDriver implements DriverContract {
100102 async url ( filePath : string ) : Promise < string > {
101103 const file = new File ( this . concat ( filePath ) )
102104
103- if ( ! file . originalFileExists ) throw new InternalServerException ( `File ${ filePath } does not exist` )
105+ if ( ! file . originalFileExists )
106+ throw new InternalServerException ( `File ${ filePath } does not exist` )
104107
105108 return `${ this . _url } /${ file . base } `
106109 }
@@ -114,9 +117,12 @@ export class LocalDriver implements DriverContract {
114117 async temporaryUrl ( filePath : string , time = 900000 ) : Promise < string > {
115118 const file = await new File ( this . concat ( filePath ) )
116119
117- if ( ! file . originalFileExists ) throw new InternalServerException ( `File ${ filePath } does not exist` )
120+ if ( ! file . originalFileExists )
121+ throw new InternalServerException ( `File ${ filePath } does not exist` )
118122
119- const copy = await file . copy ( `storage/temp/${ filePath } ` , { mockedValues : true } )
123+ const copy = await file . copy ( `storage/temp/${ filePath } ` , {
124+ mockedValues : true ,
125+ } )
120126
121127 setTimeout ( ( ) => copy . remove ( ) , time )
122128
@@ -132,7 +138,8 @@ export class LocalDriver implements DriverContract {
132138 async delete ( filePath : string , force = false ) : Promise < void > {
133139 const file = new File ( this . concat ( filePath ) )
134140
135- if ( ! file . originalFileExists && ! force ) throw new InternalServerException ( `File ${ filePath } does not exist` )
141+ if ( ! file . originalFileExists && ! force )
142+ throw new InternalServerException ( `File ${ filePath } does not exist` )
136143
137144 await promises . rm ( this . concat ( filePath ) , { force } )
138145 }
@@ -146,7 +153,8 @@ export class LocalDriver implements DriverContract {
146153 async copy ( oldFilePath : string , newFilePath : string ) : Promise < void > {
147154 const file = new File ( this . concat ( oldFilePath ) )
148155
149- if ( ! file . originalFileExists ) throw new InternalServerException ( `File ${ oldFilePath } does not exist` )
156+ if ( ! file . originalFileExists )
157+ throw new InternalServerException ( `File ${ oldFilePath } does not exist` )
150158
151159 await file . copy ( this . concat ( newFilePath ) )
152160 }
@@ -160,7 +168,8 @@ export class LocalDriver implements DriverContract {
160168 async move ( oldFilePath : string , newFilePath : string ) : Promise < void > {
161169 const file = new File ( this . concat ( oldFilePath ) )
162170
163- if ( ! file . originalFileExists ) throw new InternalServerException ( `File ${ oldFilePath } does not exist` )
171+ if ( ! file . originalFileExists )
172+ throw new InternalServerException ( `File ${ oldFilePath } does not exist` )
164173
165174 await file . move ( this . concat ( newFilePath ) )
166175 }
0 commit comments