Skip to content

Commit

Permalink
fix(fs): actually expose write options for .write
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha committed Sep 15, 2021
1 parent 15cb99d commit 55ae27d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/fs/src/fs.abstraction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Readable } from 'stream';
import { FileInfo, FileSystem } from '@chunkd/core';
import { FileInfo, FileSystem, WriteOptions } from '@chunkd/core';

export type FileWriteTypes = Buffer | Readable | string | Record<string, unknown> | Array<unknown>;

Expand Down Expand Up @@ -75,11 +75,11 @@ export class FileSystemAbstraction {
* @param filePath file to write
* @param buffer buffer or stream to write
*/
write(filePath: string, buffer: FileWriteTypes): Promise<void> {
write(filePath: string, buffer: FileWriteTypes, opts?: WriteOptions): Promise<void> {
if (Array.isArray(buffer) || isRecord(buffer)) {
return this.get(filePath).write(filePath, JSON.stringify(buffer, null, 2));
return this.get(filePath).write(filePath, JSON.stringify(buffer, null, 2), opts);
}
return this.get(filePath).write(filePath, buffer);
return this.get(filePath).write(filePath, buffer, opts);
}

/**
Expand Down

0 comments on commit 55ae27d

Please sign in to comment.