ipfs-shipyard / java-ipfs-http-client

A Java implementation of the HTTP IPFS API
MIT License
538 stars 243 forks source link

Can't wrap files in directory when uploading in Windows #156

Closed bobbyharsono closed 1 year ago

bobbyharsono commented 4 years ago

I'm using:

Chronology: I tried to make a spring boot service which receive multiple files uploaded by user, my service accept files as (Java) Multipart for its type;

First, i convert all multiparts into list of bytes array then running into this function image

That should return list of named streamable, which i use in below function to upload to ipfs: image

As we can see, i intend to wrap those files into 1 single directory which i can named;

Then i tested it using postman to upload 2 files, if the wrap flag is true, it returns 4 hash:

____ Automatically created directory (lets call this H1) | My supposed to be directory (lest call this H2) | My file 1 (lets call this H3) |____ My file 2 (lets call this H4)

My target is ____ H2 | H3 | H4

If wrap flag set to false, it returns 3 hash: ____ root directory | H2 | H3 |____ H4

Another thing is, when im uploading files using byteArrayWrapper, seems like i cannot retain its original filename, whilst uploading single file using dirWrapper works perfectly (correct directory structure and original filename retained after uploaded in ipfs)

kevodwyer commented 1 year ago

I attempted to replicate the above, but am not sure i understand the problem that you are seeing. Can you re-phrase? I would not expect the individual filenames to be retained as they are not provided to the add api when uploading via DirWrapper. Recently the new ipfs.files.write() method has been added to this client. That may be closer to your needs.

kevodwyer commented 1 year ago

Closing issue as stale. Feel free to re-open with new information.