File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -197,13 +197,18 @@ export class File implements FileLike {
197
197
* Creates a clone of the file with a new `documentObj`. This is the
198
198
* recommended way of duplicating files, as it will prevent them both
199
199
* referencing the same documentObj.
200
+ * @param overrides Override any of the `FileDetails` that initialize `File`.
201
+ * Note that `fileObj` will be overridden by the `documentObj` in overrides,
202
+ * or cloned from this file.
200
203
*/
201
- clone ( ) {
204
+ clone ( overrides ?: Partial < FileDetails > ) {
205
+ const { documentObj, ...rest } = overrides || { } ;
202
206
return new File ( {
203
207
name : this . name ,
204
208
originalName : this . originalName ,
205
209
extension : this . extension ,
206
- documentObj : blobToDocument ( documentToBlob ( this . documentObj . get ( ) ) , this . extension ) ,
210
+ ...rest ,
211
+ documentObj : documentObj || blobToDocument ( documentToBlob ( this . documentObj . get ( ) ) , this . extension ) ,
207
212
} ) ;
208
213
}
209
214
You can’t perform that action at this time.
0 commit comments