This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +10
-2
lines changed
interface-ipfs-core/src/files
ipfs-core/src/components/files 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,14 @@ export function testRead (factory, options) {
112
112
expect ( testFileData ) . to . eql ( fixtures . smallFile . data )
113
113
} )
114
114
115
+ it ( 'should be able to read rawLeaves files' , async ( ) => {
116
+ const { cid } = await ipfs . add ( fixtures . smallFile . data , {
117
+ rawLeaves : true
118
+ } )
119
+ const testFileData = uint8ArrayConcat ( await all ( ipfs . files . read ( `/ipfs/${ cid } ` ) ) )
120
+ expect ( testFileData ) . to . eql ( fixtures . smallFile . data )
121
+ } )
122
+
115
123
describe ( 'with sharding' , ( ) => {
116
124
/** @type {import('ipfs-core-types').IPFS } */
117
125
let ipfs
Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ export function createRead (context) {
39
39
const mfsPath = await toMfsPath ( context , path , options )
40
40
const result = await exporter ( mfsPath . mfsPath , context . repo . blocks )
41
41
42
- if ( result . type !== 'file' ) {
43
- throw errCode ( new Error ( `${ path } was not a file` ) , 'ERR_NOT_FILE' )
42
+ if ( result . type !== 'file' && result . type !== 'raw' ) {
43
+ throw errCode ( new Error ( `${ path } was not a file or raw bytes ` ) , 'ERR_NOT_FILE' )
44
44
}
45
45
46
46
if ( ! result . content ) {
You can’t perform that action at this time.
0 commit comments