File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -817,7 +817,7 @@ class FdEntry final : public EntryImpl {
817
817
uint64_t new_start = start_ + start;
818
818
uint64_t new_end = end_;
819
819
if (end.has_value ()) {
820
- new_end = std::min (end.value () + start, new_end );
820
+ new_end = std::min (end.value (), end_ );
821
821
}
822
822
823
823
CHECK (new_start >= start_);
@@ -881,7 +881,7 @@ class FdEntry final : public EntryImpl {
881
881
file,
882
882
Local<Object>(),
883
883
entry->start_ ,
884
- entry->end_ )),
884
+ entry->end_ - entry-> start_ )),
885
885
entry);
886
886
}
887
887
Original file line number Diff line number Diff line change @@ -68,6 +68,23 @@ writeFileSync(testfile3, '');
68
68
await unlink ( testfile ) ;
69
69
} ) ( ) . then ( common . mustCall ( ) ) ;
70
70
71
+ ( async ( ) => {
72
+ // Refs: https://github.com/nodejs/node/issues/47683
73
+ const blob = await openAsBlob ( testfile ) ;
74
+ const res = blob . slice ( 10 , 20 ) ;
75
+ const ab = await res . arrayBuffer ( ) ;
76
+ strictEqual ( res . size , ab . byteLength ) ;
77
+
78
+ let length = 0 ;
79
+ const stream = await res . stream ( ) ;
80
+ for await ( const chunk of stream )
81
+ length += chunk . length ;
82
+ strictEqual ( res . size , length ) ;
83
+
84
+ const res1 = blob . slice ( 995 , 1005 ) ;
85
+ strictEqual ( await res1 . text ( ) , data . slice ( 995 , 1005 ) ) ;
86
+ } ) ( ) . then ( common . mustCall ( ) ) ;
87
+
71
88
( async ( ) => {
72
89
const blob = await openAsBlob ( testfile2 ) ;
73
90
const stream = blob . stream ( ) ;
You can’t perform that action at this time.
0 commit comments