File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ export const byteLength = (input: any): number | undefined => {
2929 } else if ( typeof input . start === "number" && typeof input . end === "number" ) {
3030 // file read stream with range.
3131 return input . end + 1 - input . start ;
32- } else if ( typeof input . path === "string" ) {
33- // file read stream with path.
32+ } else if ( runtimeConfig . isFileReadStream ( input ) ) {
3433 try {
3534 return runtimeConfig . lstatSync ( input . path ) . size ;
3635 } catch ( error ) {
Original file line number Diff line number Diff line change 33 */
44export const runtimeConfigShared = {
55 lstatSync : ( ) => { } ,
6+ isFileReadStream ( f : unknown ) {
7+ return false ;
8+ } ,
69} ;
Original file line number Diff line number Diff line change 1- import { lstatSync } from "fs" ;
1+ import { lstatSync , ReadStream } from "fs" ;
22
33import { runtimeConfigShared as shared } from "./runtimeConfig.shared" ;
44
@@ -9,4 +9,7 @@ export const runtimeConfig = {
99 ...shared ,
1010 runtime : "node" ,
1111 lstatSync,
12+ isFileReadStream ( f : unknown ) : f is ReadStream {
13+ return f instanceof ReadStream ;
14+ } ,
1215} ;
You can’t perform that action at this time.
0 commit comments