File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
packages/node/src/attachment Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2,18 +2,19 @@ import { BacktraceFileAttachment as CoreBacktraceFileAttachment } from '@backtra
22import fs from 'fs' ;
33import path from 'path' ;
44import { Readable } from 'stream' ;
5+ import { NodeFileSystem } from '../storage/interfaces/NodeFileSystem' ;
56
67export class BacktraceFileAttachment implements CoreBacktraceFileAttachment < Readable > {
78 public readonly name : string ;
89
9- constructor ( public readonly filePath : string , name ?: string ) {
10+ constructor ( public readonly filePath : string , name ?: string , private readonly _fileSystem ?: NodeFileSystem ) {
1011 this . name = name ?? path . basename ( this . filePath ) ;
1112 }
1213
13- public get ( ) : fs . ReadStream | undefined {
14- if ( ! fs . existsSync ( this . filePath ) ) {
14+ public get ( ) : Readable | undefined {
15+ if ( ! ( this . _fileSystem ?? fs ) . existsSync ( this . filePath ) ) {
1516 return undefined ;
1617 }
17- return fs . createReadStream ( this . filePath ) ;
18+ return ( this . _fileSystem ?? fs ) . createReadStream ( this . filePath ) ;
1819 }
1920}
You can’t perform that action at this time.
0 commit comments